adding loadImages function