Add unregistration in demo app.
Add logs and perform some refactoring.