Moved ip validation to outer scope to stop requests from hanging closes #1