Removed some duplication in services.js