Completing part 4 of assignment 1