Added some code for loading images.