starting to implement the ugly optimization problem.