undid some of the changes manually... cost fucntion is selected differently