more optimizations
more bug fixes