refactor registers