refactored task updating to use a stateful object