Refactored imagine extension.