Finish exercise 5 of homework 1