Added registration and authorization logic