changed sg = sqrt(2)*std insted of 2*std