refactoring handler and dependency life cicle