Refactored into ngResource