cleaning up code in register