added hook sync for the listener service and a LOT of refactoring