Refactored ng-objectstore prototype functions

Refactored code