Added register logic