Updated router to use profiles over base_urls

Makes the caches and lookups more consistent. Also started caching a routes table of `Controller.action => Action objects` to make the invoking of sub-controllers use their actual Action objects.