changes Chris suggested and a couple other changes, need to add correct objective function