Fix for urlmap/app order issues and refactored to use BaseHandler