Refactor widget