some major optimizations