Part 2 of comp261 assignment