Buncha tiny changes to make it compile in release mode with optimizations enabled.