Merge "Cleaning up probability/cost functions."