changed to float based computations, added gamma correction