AngularJS : Rewritting controllers and factories

Optimized factories