Added code from part2