Join common code in the stages of next_move()