converted to restangular, fixed some tests.