Set up validMove function