added validation and move logic