Index: src/foo.cpp
===================================================================
--- src/foo.cpp	(revision 407)
+++ src/foo.cpp	(working copy)
@@ -51,8 +51,7 @@
 	// put the command string together
 	
 	std::string command = type[selection.command] 
-			+ " " + "\"" + main_directory 
-			+ row[view.filename] + "\"";
+			+ " " + "\"" + row[view.filename] + "\"";
 
 	// execute the command
 	
@@ -76,8 +75,7 @@
 	// put the command string together
 	
 	std::string command = type[selection.command] + " " 
-			+ "\"" + main_directory 
-			+ row[view.filename] + "\"";
+			+ "\"" + row[view.filename] + "\"";
 	
 	// execute the command
 	
Index: src/main.cpp
===================================================================
--- src/main.cpp	(revision 407)
+++ src/main.cpp	(working copy)
@@ -22,37 +22,30 @@
 	}
 }
 
-void add_from_dir (char * dir) {
-	DIR * directory = opendir (dir);
-	chdir (dir);
+void add_from_dir (const std::string dir) {
+	DIR * directory = opendir (dir.c_str());
 	struct dirent * directory_structure;
-	
-	// we don't want . and ..
-
-	if (directory != NULL) {
-	directory_structure = readdir (directory);
-	directory_structure = readdir (directory);
-
 	struct stat file_info;
 
-	// add all image files in that directory to the tree
+	if (directory != NULL) {
 	
-	while ((directory_structure = readdir (directory)) != NULL) {
-		stat (directory_structure->d_name, &file_info);
-		if (S_ISREG (file_info.st_mode)) {
-			std::string string 
-				(directory_structure->d_name);
-			if (file_is_image (string)) {
-				foo->view.add_file (string);
+		// add all image files in that directory to the tree
+	
+		while ((directory_structure = readdir (directory)) != NULL) {
+
+			std::string fullpath = dir + "/" + std::string (directory_structure->d_name);
+			stat (fullpath.c_str(), &file_info);
+			if (S_ISREG (file_info.st_mode)) {
+				if (file_is_image (fullpath))
+					foo->view.add_file (fullpath);
 			}
+			else if (S_ISDIR (file_info.st_mode) && strcmp(directory_structure->d_name, ".") != 0 && strcmp(directory_structure->d_name, "..") != 0) {
+				add_from_dir (fullpath);
+			}
 		}
-		else if (S_ISDIR (file_info.st_mode)) {
-			add_from_dir (directory_structure->d_name);
-			chdir (dir);
-		}
+	} else {
+		std::cerr << "Could not open directory " << dir << "!";
 	}
-	}
-	chdir (dir);
 }
 
 int main (int argc, char ** argv) {
@@ -66,7 +59,7 @@
 
 	foo->show ();
 
-	add_from_dir (argv[1]);
+	add_from_dir (std::string (argv[1]));
 	
 	Gtk::Main::run (*foo);
 	return 0;
Index: src/thumbview.cpp
===================================================================
--- src/thumbview.cpp	(revision 407)
+++ src/thumbview.cpp	(working copy)
@@ -49,12 +49,17 @@
 	Gtk::TreeModel::iterator iter = store->append ();
 	Gtk::TreeModel::Row row = *iter;
 
-	printf ("getting pixbuf... ");
+	printf ("getting pixbuf (%s) ... ", file.c_str());
 
 	// put our strings together
 	
+	// replace / with _ for friendliness
+	std::string replaced = file;
+	while ( replaced.find("/") != std::string::npos )
+		replaced.replace( replaced.find("/"), 1, "_" );
+
 	std::string cachepath = std::string (getenv ("HOME")) 
-			+ std::string("/.foo/") + file;
+			+ std::string("/.foo/") + replaced;
 	std::string cache_file_string = cachepath + ".cache";
 	
 	Glib::RefPtr<Gdk::Pixbuf> thumb;
@@ -96,8 +101,10 @@
 
 	// assemble all hax
 	
+	// strip out all but last part of file
+	std::string display = std::string(file, file.rfind ("/")+1);
 	row[thumbnail] = thumb;
 	row[description] = //generate_desc (file);
-		"<b>" + file + "</b>" + '\n' + size;
+		"<b>" + display + "</b>" + '\n' + size;
 	row[filename] = file;
 }
