major refactoring of application dispatch; refactoring routing logic