Refactored to make creating different types of images (i.e. for videos) easier.