slight refactoring of widget system code