Finished Optimization exercise 1