Extensive rewriting to support 3.8 kernel and asynchronous style