added validation functionality