Added image-preloading function