refactor widget controller