refactored Image helper.