problem 4 working with images and some minor modifications