4. register logic