Refactoring and bug cleanup.
Add valueChange listener.
Add documentation.