Updated with some IP checks