added unit tests/fixed jshint/updated angular service with the new api