deleted temp, added sqrt(2) scaling and per scale weighting