Refactor async task