added gamma correction function