based on https://github.com/Quarx2k/jordan-kernel