preload images
moved preloading images to own function