Implementing the valid moves.