completed part 4 to part 7 of hw1, with some online search