Refactoring to create less leyers