refactoring so updating widget happens only in the provider