refactor layer