Creating the Register function