Finished part 3 of homework assignment 3