Many optimizations to core library.