Refactor and rewrite fetch-pages in Coffeescript