Changed service.js to somewhat resemble the server