adds crude image preloading algorithm