Updated factories.js