add part2 code and modified toggle