layer controller refactor