hw4 part 3 - my own copy added