Added proper attempt to grayscale calculation