refactor widget class