Modified to take an object which allows you to specify a callback instead of assuming an image.