port to restangular, simplify code