       else
         @$apply fn
 
-    # when state or district change
+    # when state, district or ward change
     scope.$watchCollection ->
-      [scope.stateBoundary, scope.districtBoundary]
+      [scope.stateBoundary, scope.districtBoundary, scope.wardBoundary]
     , (current, previous) ->
 
       scope.safeApply ->
         if current
-          if scope.districtBoundary
-            loadState(scope.stateBoundary.osm_id, [scope.districtBoundary.osm_id])
+          if scope.wardBoundary
+            loadAdminLevel(scope.districtBoundary.osm_id, [scope.wardBoundary.osm_id])
+          else if scope.districtBoundary
+            loadAdminLevel(scope.stateBoundary.osm_id, [scope.districtBoundary.osm_id])
           else if scope.stateBoundary
             resetStates([scope.stateBoundary.osm_id])
           else

        return boundary.name.toLowerCase().indexOf($scope.query.toLowerCase()) > -1
      return true

  $scope.clickBoundary = (state, district) ->

    $scope.safeApply ->
      $scope.stateBoundary = state
      $scope.districtBoundary = district

      if district
        $scope.currentBoundary = district
      else
        $scope.currentBoundary = state

      $scope.query = ''
      $scope.stateBoundary = null
      $scope.districtBoundary = null
      $scope.wardBoundary = null

  $scope.saveAliases = ->
    $scope.safeApply ->
      # cleanse our aliases before saving them
      aliases = $scope.currentAliases.split('\n')
      new_aliases = ''
      delim = ''
      for alias in aliases
        if alias.strip().length > 0
          new_aliases += delim + alias
          delim = '\n'

      $scope.currentBoundary.aliases = new_aliases

      if $scope.currentBoundary.level == 3
        newMatch = ' ' + $scope.currentBoundary.name.toLowerCase() + ' ' + $scope.currentBoundary.aliases.toLowerCase()
        $scope.districtBoundary.match += newMatch
        newMatch = $scope.districtBoundary.name.toLowerCase() + ' ' + $scope.districtBoundary.aliases.toLowerCase() + newMatch
        $scope.stateBoundary.match += newMatch
        $scope.currentBoundary.match = $scope.stateBoundary.name.toLowerCase() + ' ' + $scope.stateBoundary.aliases.toLowerCase() + newMatch
      else if $scope.currentBoundary.level == 2
        # update our querying to include aliases
        newMatch = ' ' + $scope.currentBoundary.name.toLowerCase() + ' ' + $scope.currentBoundary.aliases.toLowerCase()
        if $scope.currentBoundary.children?
          for child in $scope.currentBoundary.children
            child.match += newMatch

        $scope.currentBoundary.match = $scope.stateBoundary.name.toLowerCase() + ' ' + $scope.stateBoundary.aliases.toLowerCase() + newMatch
        $scope.stateBoundary.match += newMatch
        # $scope.currentBoundary = $scope.stateBoundary
      else
        parentMatch = ' ' + $scope.currentBoundary.name.toLowerCase() + ' ' + $scope.currentBoundary.aliases.toLowerCase()
        childMatch = ''
        subChildMatch = ''
        if $scope.currentBoundary.children?
          for child in $scope.currentBoundary.children
            child.match += parentMatch
