Refactor promises in Application.index.