Move the logic into the provider