adding checks for part 3 of assignment