Replaced if with when-not in valid-moves.