Made some major performance improvements.