core refactoring with container DI y gatekeeper