refactor widget and reorganize