adding registration functionality. need to close connections
registration is working