stores and returns the registration id

This code is still not in a usable, production form but it's getting
there.