services.js improved