Added image preloading functionality.