refactor widget and ui