I should mention that I only call this paint routine once when the images are downloaded (or resynced) so there is no issue of files being repeatedly loaded. However if you do want to repaint more than once you could use an array to keep track of which files you've loaded or use a variable as a flag to indicate if all the image have aready been loaded.