some cleanup in adjustGrayScale