2.5 opt and a few optimizations