Refactor to use widget framework