more validation checks and checks for error conditions