       $scope.currentPage = Math.min($scope.totalPages - 1, $scope.currentPage + 1)
       $scope.loadRelics()
 
+    createMarker = (relic) ->
+      new google.maps.Marker
+        map: $scope.map.instance
+        position: relicLatLng(relic)
+        icon: gmap_marker # From variables.js
+
     $scope.selectRelic = (relic) ->
-      $scope.widget.relics.push(angular.copy(relic))
+      _relic = angular.copy(relic)
+      _relic.marker = createMarker(_relic)
+      $scope.widget.relics.push(_relic)
       $scope.drawRoute()
 
     $scope.filteredSuggestions = ->

      success = (response) ->
        $scope.loading = false
        $scope.widget = angular.copy(response.data)

      error = (response) ->
        $scope.loading = false

      $scope.totalPages = -1

    $scope.clearRoute = ->
      for promise in findRoutePromises
        $timeout.cancel(promise)

      for renderer in directionsRenderers
        renderer.setMap(null)

      findRoutePromises   = []
      directionsRenderers = []
      directionsData      = []

    relicLatLng = (relic) ->
      new google.maps.LatLng(relic.latitude, relic.longitude)

    requestParams = (relics) ->
      origin: relicLatLng(relics.first())
      destination: relicLatLng(relics.last())
      waypoints: relics.slice(1, -1).map (relic) -> location: relicLatLng(relic)
      travelMode: google.maps.TravelMode.WALKING

    relicsIntoChunks = ->
      relics = $scope.widget.relics
      return [] if !relics.length
      chunks = []
      for i in [0...relics.length] by 9
        chunk = relics.slice(i, i + 10)
        chunks.push(chunk) if chunk.length > 1
      chunks

    renderDirections = (callback) ->
      latLngBounds = new google.maps.LatLngBounds()

      for index in [0...directionsData.length]
        data = directionsData[index]
        directionsRenderer = new google.maps.DirectionsRenderer
          suppressMarkers: true
          preserveViewport: true
        directionsRenderer.setDirections(data)
        directionsRenderer.setMap($scope.map.instance)
        directionsRenderers.push(directionsRenderer)

        for route in data.routes
          latLngBounds.union(route.bounds)

        if directionsData.length == index + 1
          $scope.map.instance.fitBounds(latLngBounds, true)
          callback()

    findRoute = (index = 0) ->
      relics  = relicsChunks[index]
      request = requestParams(relics)
      last    = index + 1 == relicsChunks.length

      directionsService.route request, (result, status) ->
        if status == google.maps.DirectionsStatus.OK
          directionsData.push(result)
          if last
            # Render directions if this is the last request
            renderDirections ->
              $scope.loading = false
          else
            # Delay every two requests to prevent OVER_QUERY_LIMIT
            delay = if index % 2
              1000
            else
              50
            promise = $timeout ->
              findRoute(index + 1)
            , delay
            findRoutePromises.push(promise)
        else
          console.error status # TODO: handle error

    $scope.drawRoute = ->
      # Split relics in to chunks to prevent MAX_WAYPOINTS_EXCEEDED error
      relicsChunks = relicsIntoChunks()
      $scope.loading = true
      $scope.clearRoute()

      if $scope.widget.relics.length < 2
        return $scope.resetMap()

      promise = $timeout ->
        findRoute()
      , 1000
      findRoutePromises.push(promise)

    $scope.sortableOptions =
      update: (e, ui) ->
