simplify the register code a bit