more changes to the image processing code