-optimization +correctness (I hope)