add logic for Register