add register logic