Added grayscale support