Refactor curve25519