Added test_urlhandling.  Improved code refactoring