refactor getRegister