Added support for preloading images.