moving validation steps into their own functions