changed the hard-coded paths of images to dynamic