Re-wrote the excercise following the readings and examples