img refactor