Refactor of Sheer's URL handling code

This is much simpler, but I might need some help from @dpford figuring out some lingering issues, mostly related to macro's