refactored code for image processing into the ImageProcessor class.
merged with josh