refactoring layers