added image refactor method