moved some code upstream to catch outliers