begin to accomplish the register function