Split reregister from register
Refactor Java and Pure implementations to share most code
Fixup C implementation to work with refactored interfaces