Large refactoring:

* Extracted out WidgetFactory interface.
* Introduced dependency injection.
* Added argument filters to allow arguments to be
  mangled before objects are instantiated.

TODO: Argument filter changes are not reflected in the displayed code.