Added code for part 2