Move isValidPoint to its proper location