image layer refactoring