added  comments adn fixed unregistration