refactoring to modular structure
add TemplateMixin for a more unified creation of widgets