Moved factory to services.js file