adding grayscale algo
bug correction
bug correction