simplified it and made it work with recent kernels