Added a handler registry service and refactored.