   # Remove the trailing space
   if /\d(\s|\/)+$/.test(value)
     e.preventDefault()
-    $target.val(value.replace(/\d(\s|\/)*$/, ''))
+    setTimeout -> $target.val(value.replace(/\d(\s|\/)*$/, ''))
   else if /\s\/\s?\d?$/.test(value)
     e.preventDefault()
-    $target.val(value.replace(/\s\/\s?\d?$/, ''))
+    setTimeout -> $target.val(value.replace(/\s\/\s?\d?$/, ''))
 
 #  Restrictions
 

  # Remove the trailing space
  if /\d\s$/.test(value)
    e.preventDefault()
    $target.val(value.replace(/\d\s$/, ''))
  else if /\s\d?$/.test(value)
    e.preventDefault()
    $target.val(value.replace(/\s\d?$/, ''))

# Format Expiry

formatExpiry = (e) ->
  $target = $(e.currentTarget)
  val     = $target.val()

  if e.which
    digit = String.fromCharCode(e.which)
    return unless /^\d+$/.test(digit)
    val += digit

  if /^\d$/.test(val) and val not in ['0', '1']
    e.preventDefault()
    $target.val("0#{val} / ")

  else if /^\d{2}$/.test(val)
    e.preventDefault()
    $target.val("#{val} / ")

  else if /^\d{3}$/.test(val)
    e.preventDefault()
    $target.val("#{val.slice(0, 2)} / #{val.slice(2, 3)}")

formatForwardSlash = (e) ->
  slash = String.fromCharCode(e.which)

    groups.shift()
    groups = $.grep(groups, (n) -> n) # Filter empty groups
    groups.join(' ')

$.payment.formatExpiry = (expiry) ->
  parts = expiry.match(/^\D*(\d{1,2})(\D+)?(\d{1,4})?/)
  return '' unless parts

  mon = parts[1] || ''
  sep = parts[2] || ''
  year = parts[3] || ''

  if year.length > 0 || (sep.length > 0 && !(/\ \/?\ ?/.test(sep)))
    sep = ' / '

  if mon.length == 1 and mon not in ['0', '1']
    mon = "0#{mon}"
    sep = ' / '

  return mon + sep + year
