Heavy refactor to extract Widget as a class.