refactor widget