replaced arbitrarily small thresholds by 0 where it was sensible with respect to IEEE754 removed unnecessary else clauses removed double indices where possible fixed some comments