Reorganize src/js/factories.coffee and redocument