a bunch of changes to factory.coffee