Refactoring for layers