Refactor state of refresh control using task