Now loads the images at the start 

The program now uses onload function to load the images when the document first loads