Added support to distinguish between monochrome and color images
Minor tweaks