diff --git a/spatial_file/spatial_file.module b/spatial_file/spatial_file.module
index ad56948..af53e67 100644
--- a/spatial_file/spatial_file.module
+++ b/spatial_file/spatial_file.module
@@ -125,34 +125,34 @@ function spatial_file_get_wkt_features($uri, $enforce_extension = NULL) {
 
   if (isset($uri_chunks[1]) || !is_null($enforce_extension)) {
 
-    $file_extension = !is_null($enforce_extension) ? $enforce_extension : $uri_chunks[1];
+    $file_extension = !is_null($enforce_extension) ? $enforce_extension : array_pop($uri_chunks);
     // TODO: This should not be a switch, it should invoke a hook to get stuff back
-    switch ($file_extension) {
+    switch (drupal_strtolower($file_extension)) {
 
       case 'zip':
         if (module_exists('spatial_shapefile')) {
           return spatial_shapefile_get_wkt($uri);
         }
-
+        break;
       case 'shp':
-        if ($ogr2ogr_shapefile = ogr2ogr_open($shapefile->uri)) {
+        if ($ogr2ogr_shapefile = ogr2ogr_open($uri)) {
           if ($spatial_features = $ogr2ogr_shapefile->getWkt()) {
             return $spatial_features;
           }
         }
-
+        break;
       case 'kml':
         if (module_exists('spatial_kml')) {
           return spatial_kml_get_wkt($uri);
         }
+        break;
     }
 
-    // TODO: This should be a watchdog entry, not a dsm()
-    drupal_set_message('Spatial files of this type ('. $file_extension .') can not currently be processed', 'error');
-
+    drupal_set_message(t('Spatial files of this type (!ext) can not currently be processed', array('!ext' => $file_extension)), 'error');
+    watchdog('spatial_file', 'Spatial files of this type (!ext) can not currently be processed', array('!ext' => $file_extension),  WATCHDOG_ERROR);
   }
   else {
-    // TODO: Create watchdog entry, spatial_file_get_wkt needs the proper file extension
+    watchdog('spatial_file', 'Unable to identify file name extension of spatial file: !uri', array('!uri' => $uri),  WATCHDOG_ERROR);
   }
 }
 
