register logic