added validation for invalid move.