simplify the runtime Register reconnect logic

Refactor the Register code a little bit to make it easier to comprehend.