added factory.js file