 
           $http(options)
             .success (data, status, headers, config) ->
-                if onSuccess?
-                  fetchedList = onSuccess {data, status, headers}
-
+                fetchedList  = onSuccess?({data, status, headers})
                 fetchedList ?= data.data
 
                 resp updateList fetchedList
             .error (data, status, headers, config) ->
-              if onError?
-                onError {data, status, headers}
+              onError? {data, status, headers}
         else
           list = updateList(source($scope) or [])
           resp $filter("filter") list, req.term

      source              = $parse attrs.macAutocompleteSource
      currentAutocomplete = []

      # TODO
      if attrs.ngModel?
        $scope.$watch attrs.ngModel, (value) ->
          setTimeout ->
            element.val value
          , 0

      #

      # Event to reset autocomplete
      #
      $scope.$on "resetAutocomplete", -> reset()
]
