Work from https://github.com/majorsilence/ldtp2