refactored menu method and added ValidIP method