enhanced angularJS factory