Pre loading of images and some additional cleanup