Simplify set_registers code a bit.