Added cost function and initialized multiple start points.