Added support for service registration and preliminary code for service unregistration.