         link: (scope, elem, attrs, ngModelCtrl) ->
             options = getOptions scope, attrs
             isValid = makeIsValid options
+            reformatRequired = false
 
             ngModelCtrl.$parsers.unshift (viewVal) ->
                 noCommasVal = viewVal.replace /,/g, ''

                val

            elem.on 'keyup', (event) ->
              return if invalidInput(elem, event, options)

              if event.which == 8 # backspace is pressed
                if elem.val().length == 4 || elem.val().length == 8 # a new comma is added
                  newCursorPosition = elem[0].selectionStart - 1
                else
                  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 field
                  newCursorPosition = elem[0].selectionStart
                else # cursor is adding numbers at the end of the input field
                  newCursorPosition = elem[0].selectionStart + 1

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

              # not updating unless value is longer than 4 digits including commas
              # still some issues moving the comma after input/delete

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

    insertCharacter = (elem, event) ->
      character = keyCodes[event.which]
      originalValue = elem.val()
      position = elem[0].selectionStart
      
      [originalValue.slice(0, position), b, originalValue.slice(position)].join('')

    makeIsValid = (options) ->
        validations = []
