image refactoring