Finished part 3 of homework 3