added validation logic