Some refactoring concerning widgets (heavy work in progress)