Rewrote the URL parsing

If there is such a thing as 'too much ternary statements', this is probably it