 NumberModule = angular.module('smart-number', [])
 
 NumberModule.directive 'smartNumber',
-['NumberConfig', (smartNumberConfig) ->
-
-    defaultOptions = NumberConfig.defaultOptions
+['smartNumberConfig', (smartNumberConfig) ->
+
+    defaultOptions = smartNumberConfig.defaultOptions
     controlKeys = [0,8,13] # 0 = tab, 8 = backspace , 13 = enter
 
     getOptions = (scope, attrs) ->
         options = angular.copy defaultOptions
-        if attrs.NumberOptions?
-            for own option, value of scope.$eval(attrs.NumberOptions)
+        if attrs.smartNumberOptions?
+            for own option, value of scope.$eval(attrs.smartNumberOptions)
                 options[option] = value
         options
     

                else
                  newCursorPosition = elem[0].selectionStart
              else
                if elem.val().length >= options.maxDigits # maxDigits has been reached
                  newCursorPosition = elem[0].selectionStart
                else
                  if elem.val().length == 4 || elem.val().length == 8 # a new comma is added
                    newCursorPosition = elem[0].selectionStart + 1
                  else
                    if elem[0].selectionStart < elem.val().length # cursor is adding numbers, but is not at the end of the input
                      newCursorPosition = elem[0].selectionStart # otherwise
                    else
                      newCursorPosition = elem[0].selectionStart + 1 # otherwise

              elem.val resetCommas(elem.val()) # reformat the number in place
              elem[0].setSelectionRange(newCursorPosition, newCursorPosition) # set the new cursor position

    makeMaxDigits = (maxDigits) ->
        validRegex = new RegExp "^-?\\d{0,#{maxDigits}}(\\.\\d*)?$"
        (val) -> validRegex.test val

    backspaceAtComma = (elem, event) ->
      cursorPos = elem[0].selectionStart
      elem.val().charAt(elem[0].selectionStart - 1) == "," and event.which == 8
    
    deleteAtComma = (elem, event) ->
      cursorPos = elem[0].selectionStart
      elem.val().charAt(cursorPos) == "," and event.which == 46

    moveCursorLeft = (elem) ->
      newCursorPos = elem[0].selectionStart - 1
      elem[0].setSelectionRange(newCursorPos, newCursorPos)

    moveCursorRight = (elem) ->
      newCursorPos = elem[0].selectionStart + 1
      elem[0].setSelectionRange(newCursorPos, newCursorPos)

    makeIsValid = (options) ->
        validations = []
