Refactoring async.loadImage.