Adding test cases for RemoteIP
Some more refactoring
Another Python 2.5 fix