Refactoring and reg dump