part2 code logic checked, needed to run and test