Various engine logic optimizations and many features added.