Implemented the Register function