Refactor async code in index action.