Better code structure
Use of $resource instead of $http