optimizations everywhere, it should run much faster