refactoring in ImageExpand