index.coffee refactor