Implemented valid move logic