Greatly clean up and optimize core and Netty implementation.