Refactoring register and recovery pass
Refactoring register