Perceptually linear goodness arrived

not perfect yet, but works quite well.