Updating code to layer refactoring