HG-367: Working version of new url parsing;

STILL WORK IN PROGRESS. NEEDS MORE REFACTORING.
DO NOT MERGE