Replaced pow(x,2) with sqr, pow(x,0.5) with sqrt