Did some code cleaning
Fixed an error in two pass std calculation