added validation functions.