part 1 implementation