submission for Programming Assignement 2, part 2