added valid ip checks