Added db functionality to register.