Changed isValid(Point p)