Added retries support to tasks. Need to add more coverage around it.