diff --git a/archival/dpkg.c b/archival/dpkg.c
index d0728d9..0d2b2dc 100644
--- a/archival/dpkg.c
+++ b/archival/dpkg.c
@@ -20,7 +20,7 @@
 #define DODEPENDS 1
 
 /* Should we do debugging? */
-//#define DODEBUG 1
+#define DODEBUG 0
 
 #ifdef DODEBUG
 #define SYSTEM(x) do_system(x)
@@ -32,63 +32,68 @@
 
 /* from dpkg-deb.c */
 
-static const int dpkg_deb_contents = 1;
-static const int dpkg_deb_control = 2;
-//	const int dpkg_deb_info = 4;
-static const int dpkg_deb_extract = 8;
-static const int dpkg_deb_verbose_extract = 16;
-static const int dpkg_deb_list = 32;
-
 static const char statusfile[] = "/var/lib/dpkg/status.udeb";
 static const char new_statusfile[] = "/var/lib/dpkg/status.udeb.new";
 static const char bak_statusfile[] = "/var/lib/dpkg/status.udeb.bak";
 
-static const char dpkgcidir[] = "/var/lib/dpkg/tmp.ci/";
-
 static const char infodir[] = "/var/lib/dpkg/info/";
 static const char udpkg_quiet[] = "UDPKG_QUIET";
 
 //static const int status_want_unknown	= 1;
-static const int status_want_install	= 2;
-//static const int status_want_hold	= 3;
-//static const int status_want_deinstall	= 4;
-//static const int status_want_purge	= 5;
+static const int state_want_install	= 2;
+//static const int state_want_hold	= 3;
+//static const int state_want_deinstall	= 4;
+//static const int state_want_purge	= 5;
 
-static const int status_flag_ok	= 1;
-//static const int status_flag_reinstreq = 2; 
-//static const int status_flag_hold	= 3;
-//static const int status_flag_holdreinstreq = 4;
+static const int state_flag_ok	= 1;
+//static const int state_flag_reinstreq = 2; 
+//static const int state_flag_hold	= 3;
+//static const int state_flag_holdreinstreq = 4;
 
-//static const int status_statusnoninstalled = 1;
-static const int status_status_unpacked	= 2;
-static const int status_status_halfconfigured = 3; 
-static const int status_status_installed	= 4;
-static const int status_status_halfinstalled	= 5;
-//static const int status_statusconfigfiles	= 6;
-//static const int status_statuspostinstfailed	= 7;
-//static const int status_statusremovalfailed	= 8;
+//static const int state_statusnoninstalled = 1;
+static const int state_status_unpacked	= 2;
+static const int state_status_halfconfigured = 3; 
+static const int state_status_installed	= 4;
+static const int state_status_halfinstalled	= 5;
+//static const int state_statusconfigfiles	= 6;
+//static const int state_statuspostinstfailed	= 7;
+//static const int state_statusremovalfailed	= 8;
 
-static const char *status_words_want[] = { "unknown", "install", "hold", "deinstall", "purge", 0 };
-static const char *status_words_flag[] = { "ok", "reinstreq", "hold", "hold-reinstreq", 0 };
-static const char *status_words_status[] = { "not-installed", "unpacked", "half-configured", "installed", 
+static const char *state_words_want[] = { "unknown", "install", "hold", "deinstall", "purge", 0 };
+static const char *state_words_flag[] = { "ok", "reinstreq", "hold", "hold-reinstreq", 0 };
+static const char *state_words_status[] = { "not-installed", "unpacked", "half-configured", "installed", 
 		"half-installed", "config-files", "post-inst-failed", "removal-failed", 0 };
 
 static const int color_white	= 0;
 static const int color_grey	= 1;
 static const int color_black	= 2;
 
-/* data structures */
+/* data structures */ 
 typedef struct package_s {
-	char *file;
+	char *filename;
 	char *package;
-	char *version;
+	unsigned char state_want;
+	unsigned char state_flag;
+	unsigned char state_status;
 	char *depends;
 	char *provides;
 	char *description;
+	char *priority;
+	char *section;
+	char *installed_size;
+	char *maintainer;
+	char *source;
+	char *version;
+	char *pre_depends;
+	char *replaces;
+	char *recommends;
+	char *suggests;
+	char *conflicts;
+	char *conffiles;
+	char *long_description;
+	char *architecture;
+	char *md5sum;
 	int installer_menu_item;
-	unsigned char status_want;
-	unsigned char status_flag;
-	unsigned char status_status;
 	char color; /* for topo-sort */
 	struct package_s *requiredfor[DEPENDSMAX]; 
 	unsigned short requiredcount;
@@ -265,8 +270,8 @@
 			/* Check for dependencies; first look for installed packages */
 			dependpkg.package = dependsvec[i];
 			if (((found = tfind(&dependpkg, &status, package_compare)) == 0) ||
-			    ((chk = *(package_t **)found) && (chk->status_flag & status_flag_ok) &&
-				(chk->status_status & status_status_installed))) {
+			    ((chk = *(package_t **)found) && (chk->state_flag & state_flag_ok) &&
+				(chk->state_status & state_status_installed))) {
 
 				/* if it fails, we look through the list of packages we are going to 
 				 * install */
@@ -328,47 +333,100 @@
 }
 
 /*
- * Read a control file (or a stanza of a status file) and parse it,
+ * Read the buffered control file and parse it,
  * filling parsed fields into the package structure
  */
-static int control_read(FILE *file, package_t *p)
+static int fill_package_struct(package_t *package, const char *package_buffer)
 {
-	char *line;
+	char *field = NULL;
+	int field_start = 0;
+	int field_length = 0;
+	while ((field = read_package_field(&package_buffer[field_start])) != NULL) {
+		field_length = strlen(field);
+		field_start += (field_length + 1);
 
-	while ((line = get_line_from_file(file)) != NULL) {
-		line[strlen(line) - 1] = '\0';
-
-		if (strlen(line) == 0) {
+		if (strlen(field) == 0) {
+			printf("empty line: *this shouldnt happen i dont think*\n");
 			break;
 		}
-		else if (strstr(line, "Package: ") == line) {
-				p->package = xstrdup(line + 9);
+
+		/* these are common to both installed and uninstalled packages */
+		if (strstr(field, "Package: ") == field) {
+			package->package = strdup(field + 9);
 		}
-		else if (strstr(line, "Status: ") == line) {
-				char *word_pointer;
-				word_pointer = strchr(line, ' ') + 1;
-				p->status_want = status_parse(word_pointer, status_words_want);
-				word_pointer = strchr(word_pointer, ' ') + 1;
-				p->status_flag = status_parse(word_pointer, status_words_flag);
-				word_pointer = strchr(word_pointer, ' ') + 1;
-				p->status_status = status_parse(word_pointer, status_words_status);
+		else if (strstr(field, "Depends: ") == field) {
+			package->depends = strdup(field + 9);
 		}
-		else if (strstr(line, "Depends: ") == line) {
-				p->depends = xstrdup(line + 9);
+		else if (strstr(field, "Provides: ") == field) {
+			package->provides = strdup(field + 10);
 		}
-		else if (strstr(line, "Provides: ") == line) {
-				p->provides = xstrdup(line + 10);
-		}
-		else if (strstr(line, "Description: ") == line) {
-				p->description = xstrdup(line + 13);
 		/* This is specific to the Debian Installer. Ifdef? */
+		else if (strstr(field, "installer-menu-item: ") == field) {
+			package->installer_menu_item = atoi(field + 21);
 		}
-		else if (strstr(line, "installer-menu-item: ") == line) {
-				p->installer_menu_item = atoi(line + 21);
+		else if (strstr(field, "Description: ") == field) {
+			package->description = strdup(field + 13);
 		}
-		/* TODO: localized descriptions */
+		else if (strstr(field, "Priority: ") == field) {
+			package->priority = strdup(field + 10);
+		}
+		else if (strstr(field, "Section: ") == field) {
+			package->section = strdup(field + 9);
+		}
+		else if (strstr(field, "Installed-Size: ") == field) {
+			package->installed_size = strdup(field + 16);
+		}
+		else if (strstr(field, "Maintainer: ") == field) {
+			package->maintainer = strdup(field + 12);
+		}
+		else if (strstr(field, "Version: ") == field) {
+			package->version = strdup(field + 9);
+		}
+		else if (strstr(field, "Suggests: ") == field) {
+			package->suggests = strdup(field + 10);
+		}
+		else if (strstr(field, "Recommends: ") == field) {
+			package->recommends = strdup(field + 12);
+		}
+/*		else if (strstr(field, "Conffiles: ") == field) {
+			package->conffiles = read_block(file);
+				package->conffiles = xcalloc(1, 1);
+				while ((field = strtok(NULL, "\n")) != NULL) {
+					package->long_description = xrealloc(package->conffiles, 
+					strlen(package->conffiles) + strlen(field) + 1);
+					strcat(package->conffiles, field);
+				}
+			}
+*/
+		/* These are only in available file */
+		else if (strstr(field, "Architecture: ") == field) {
+			package->architecture = strdup(field + 14);
+		}
+		else if (strstr(field, "Filename: ") == field) {
+			package->filename = strdup(field + 10);
+		}
+		else if (strstr(field, "MD5sum ") == field) {
+			package->md5sum = strdup(field + 7);
+		}
+
+		/* This is only needed for status file */
+		if (strstr(field, "Status: ") == field) {
+			char *word_pointer;
+
+			word_pointer = strchr(field, ' ') + 1;
+			package->state_want = status_parse(word_pointer, state_words_want);
+			word_pointer = strchr(word_pointer, ' ') + 1;
+			package->state_flag = status_parse(word_pointer, state_words_flag);
+			word_pointer = strchr(word_pointer, ' ') + 1;
+			package->state_status = status_parse(word_pointer, state_words_status);
+		} else {
+			package->state_want = status_parse("purge", state_words_want);
+			package->state_flag = status_parse("ok", state_words_flag);
+			package->state_status = status_parse("not-installed", state_words_status);
+		}
+
+		free(field);
 	}
-	free(line);
 	return EXIT_SUCCESS;
 }
 
@@ -377,6 +435,7 @@
 	FILE *f;
 	void *status = 0;
 	package_t *m = 0, *p = 0, *t = 0;
+	char *package_control_buffer = NULL;
 
 	if (getenv(udpkg_quiet) == NULL) {
 		printf("(Reading database...)\n");
@@ -386,9 +445,11 @@
 		return(NULL);
 	}
 
-	while (!feof(f)) {
+	while ( (package_control_buffer = read_text_file_to_buffer(f)) != NULL) {
 		m = (package_t *)xcalloc(1, sizeof(package_t));
-		control_read(f, m);
+		printf("read buffer [%s]\n", package_control_buffer);
+		fill_package_struct(m, package_control_buffer);
+		printf("package is [%s]\n", m->package);
 		if (m->package) {
 			/*
 			 * If there is an item in the tree by this name,
@@ -418,9 +479,9 @@
 					 * packages of different statuses
 				 	 * provide it).
 				 	 */
-					t->status_want = m->status_want;
-					t->status_flag = m->status_flag;
-					t->status_status = m->status_status;
+					t->state_want = m->state_want;
+					t->state_flag = m->state_flag;
+					t->state_status = m->state_status;
 				}
 			}
 		}
@@ -428,6 +489,7 @@
 			free(m);
 		}
 	}
+	printf("done\n");
 	fclose(f);
 	return status;
 }
@@ -479,9 +541,9 @@
 			}
 			if (strstr(line, "Status: ") == line && statpkg != 0) {
 				snprintf(line, sizeof(line), "Status: %s %s %s",
-					status_words_want[statpkg->status_want - 1], 
-					status_words_flag[statpkg->status_flag - 1], 
-					status_words_status[statpkg->status_status - 1]);
+					state_words_want[statpkg->state_want - 1], 
+					state_words_flag[statpkg->state_flag - 1], 
+					state_words_status[statpkg->state_status - 1]);
 			}
 			fprintf(fout, "%s\n", line);
 		}
@@ -492,9 +554,9 @@
 	// Print out packages we processed.
 	for (pkg = pkgs; pkg != 0; pkg = pkg->next) {
 		fprintf(fout, "Package: %s\nStatus: %s %s %s\n", 
-			pkg->package, status_words_want[pkg->status_want - 1],
-				status_words_flag[pkg->status_flag - 1],
-				status_words_status[pkg->status_status - 1]);
+			pkg->package, state_words_want[pkg->state_want - 1],
+				state_words_flag[pkg->state_flag - 1],
+				state_words_status[pkg->state_status - 1]);
 
 		if (pkg->depends)
 			fprintf(fout, "Depends: %s\n", pkg->depends);
@@ -544,144 +606,68 @@
 	char buf[1024];
 
 	DPRINTF("Configuring %s\n", pkg->package);
-	pkg->status_status = 0;
+	pkg->state_status = 0;
 	snprintf(postinst, sizeof(postinst), "%s%s.postinst", infodir, pkg->package);
 
 	if (is_file(postinst)) {
 		snprintf(buf, sizeof(buf), "%s configure", postinst);
 		if ((r = do_system(buf)) != 0) {
 			error_msg("postinst exited with status %d\n", r);
-			pkg->status_status = status_status_halfconfigured;
+			pkg->state_status = state_status_halfconfigured;
 			return 1;
 		}
 	}
-	pkg->status_status = status_status_installed;
+	pkg->state_status = state_status_installed;
 	
 	return 0;
 }
 
 static int dpkg_dounpack(package_t *pkg)
 {
-	int r = 0, i;
+	int r = 0;
 	int status = TRUE;
-	char *cwd = xgetcwd(0);
-	char *src_filename = NULL;
-	char *dst_filename = NULL;
-//	char *lst_file = NULL;
-	char *adminscripts[] = { "prerm", "postrm", "preinst", "postinst",
-			"conffiles", "md5sums", "shlibs", "templates" };
+	char *lst_path;
 
 	DPRINTF("Unpacking %s\n", pkg->package);
 
-	if(cwd==NULL)
-		exit(EXIT_FAILURE);
-	chdir("/");
-	deb_extract(pkg->file, dpkg_deb_extract, "/");
+	/* extract the data file */
+	deb_extract(pkg->filename, extract_extract, "/", NULL);
 
-	/* Installs the package scripts into the info directory */
-	for (i = 0; i < sizeof(adminscripts) / sizeof(adminscripts[0]); i++) {
-		struct stat src_stat_buf;
-		FILE *src_file = NULL, *dst_file = NULL;
+	/* extract the control files */
+	deb_extract(pkg->filename, extract_control, infodir, pkg->package);
 
-		/* The full path of the current location of the admin file */
-		src_filename = xrealloc(src_filename, strlen(dpkgcidir) + strlen(pkg->package) + strlen(adminscripts[i]) + 1);
-		sprintf(src_filename, "%s%s/%s", dpkgcidir, pkg->package, adminscripts[i]);
+	/* Create the list file */
+	lst_path = xmalloc(strlen(infodir) + strlen(pkg->package) + 6);
+	strcpy(lst_path, infodir);
+	strcat(lst_path, pkg->package);
+	strcat(lst_path, ".list");
+	deb_extract(pkg->filename, extract_contents_to_file, lst_path, NULL);
 
-		/* the full path of where we want the file to be copied to */
-		dst_filename = xrealloc(dst_filename, strlen(infodir) + strlen(pkg->package) + strlen(adminscripts[i]) + 1);
-		sprintf(dst_filename, "%s%s.%s", infodir, pkg->package, adminscripts[i]);
-
-		/*
-		 * copy admin file to permanent home
-		 * NOTE: Maybe merge this behaviour into libb/copy_file.c
-		 */
-		if (lstat(src_filename, &src_stat_buf) == 0) {
-			if ((src_file = wfopen(src_filename, "r")) != NULL) {
-			 	if ((dst_file = wfopen(dst_filename, "w")) == NULL) {
-					status = FALSE;
-					perror_msg("Opening %s", dst_filename);
-				}
-				copy_file_chunk(src_file, dst_file, src_stat_buf.st_size);
-				fclose(src_file);
-				fclose(dst_file);
-			} else {
-				status = FALSE;
-				error_msg("couldnt open [%s]\n", src_filename);
-			}
-		}
-	}
-
-	/* 
-	 * create the list file 
-	 * FIXME: currently this dumps the lst to stdout instead of a file
-	 */
-/*	lst_file = (char *) xmalloc(strlen(infodir) + strlen(pkg->package) + 6);
-	strcpy(lst_file, infodir);
-	strcat(lst_file, pkg->package);
-	strcat(lst_file, ".list");
-	deb_extract(dpkg_deb_list, NULL, pkg->file);
-*/
-
-	pkg->status_want = status_want_install;
-	pkg->status_flag = status_flag_ok;
+	pkg->state_want = state_want_install;
+	pkg->state_flag = state_flag_ok;
  
 	if (status == TRUE) {
-		pkg->status_status = status_status_unpacked;
+		pkg->state_status = state_status_unpacked;
 	} else {
-		pkg->status_status = status_status_halfinstalled;
+		pkg->state_status = state_status_halfinstalled;
 	}
 
-	chdir(cwd);
 	return r;
 }
 
 /*
- * Extract and parse the control.tar.gz from the specified package
+ * Extract and parse the control file from control.tar.gz
  */
-static int dpkg_unpackcontrol(package_t *pkg)
+static int dpkg_read_control(package_t *pkg)
 {
-	char *tmp_name;
-	FILE *file;
-	int length;
+	FILE *pkg_file;
+	char *control_buffer = NULL;
 
-	/* clean the temp directory (dpkgcidir) be recreating it */
-	remove_dir(dpkgcidir);
-	if (create_path(dpkgcidir, S_IRWXU) == FALSE) {
+	if ((pkg_file = wfopen(pkg->filename, "r")) == NULL) {
 		return EXIT_FAILURE;
 	}
-
-	/*
-	 * Get the package name from the file name,
-	 * first remove the directories
-	 */
-	if ((tmp_name = strrchr(pkg->file, '/')) == NULL) {
-		tmp_name = pkg->file;
-	} else {
-		tmp_name++;
-	}
-	/* now remove trailing version numbers etc */
-	length = strcspn(tmp_name, "_.");
-	pkg->package = (char *) xcalloc(1, length + 1);
-	/* store the package name */
-	strncpy(pkg->package, tmp_name, length);
-
-	/* work out the full extraction path */
-	tmp_name = (char *) xcalloc(1, strlen(dpkgcidir) + strlen(pkg->package) + 9);
-	strcpy(tmp_name, dpkgcidir);
-	strcat(tmp_name, pkg->package);
-
-	/* extract control.tar.gz to the full extraction path */
-	deb_extract(pkg->file, dpkg_deb_control, tmp_name);
-
-	/* parse the extracted control file */
-	strcat(tmp_name, "/control");
-	if ((file = wfopen(tmp_name, "r")) == NULL) {
-		return EXIT_FAILURE;
-	}
-	if (control_read(file, pkg) == EXIT_FAILURE) {
-		return EXIT_FAILURE;
-	}
-
+	control_buffer = deb_extract(pkg->filename, extract_field, NULL, NULL);
+	fill_package_struct(pkg, control_buffer);
 	return EXIT_SUCCESS;
 }
 
@@ -691,15 +677,12 @@
 	package_t *pkg;
 
 	for (pkg = pkgs; pkg != 0; pkg = pkg->next) {
-		if (dpkg_unpackcontrol(pkg) == EXIT_FAILURE) {
-			return EXIT_FAILURE;
-		}
+		dpkg_read_control(pkg);
 		if ((r = dpkg_dounpack(pkg)) != 0 ) {
 			break;
 		}
 	}
 	status_merge(status, pkgs);
-	remove_dir(dpkgcidir);
 
 	return r;
 }
@@ -735,9 +718,7 @@
 
 	/* Stage 1: parse all the control information */
 	for (p = pkgs; p != 0; p = p->next) {
-		if (dpkg_unpackcontrol(p) == EXIT_FAILURE) {
-			return(EXIT_FAILURE);
-		}
+		dpkg_read_control(p);
 	}
 
 	/* Stage 2: resolve dependencies */
@@ -749,27 +730,26 @@
 	
 	/* Stage 3: install */
 	for (p = ordered; p != 0; p = p->next) {
-		p->status_want = status_want_install;
+		p->state_want = state_want_install;
 
 		/* for now the flag is always set to ok... this is probably
 		 * not what we want
 		 */
-		p->status_flag = status_flag_ok;
+		p->state_flag = state_flag_ok;
 
 		DPRINTF("Installing %s\n", p->package);
 		if (dpkg_dounpack(p) != 0) {
-			perror_msg(p->file);
+			perror_msg(p->filename);
 		}
 
 		if (dpkg_doconfigure(p) != 0) {
-			perror_msg(p->file);
+			perror_msg(p->filename);
 		}
 	}
 
 	if (ordered != 0) {
 		status_merge(status, pkgs);
 	}
-	remove_dir(dpkgcidir);
 
 	return 0;
 }
@@ -822,7 +802,7 @@
 		if (optflag & arg_configure) {
 			p->package = xstrdup(argv[optind]);
 		} else {
-			p->file = xstrdup(argv[optind]);
+			p->filename = xstrdup(argv[optind]);
 		}
 		p->next = packages;
 		packages = p;
@@ -830,7 +810,6 @@
 		optind++;
 	}
 
-	create_path(dpkgcidir, S_IRWXU);
 	create_path(infodir, S_IRWXU);
 
 	status = status_read();
diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c
index 7c5a5de..d088828 100644
--- a/archival/dpkg_deb.c
+++ b/archival/dpkg_deb.c
@@ -15,12 +15,14 @@
  */
 
 #include <stdlib.h>
+#include <string.h>
 #include <getopt.h>
 #include "busybox.h"
 
 extern int dpkg_deb_main(int argc, char **argv)
 {
 	char *argument = NULL;
+	char *output_buffer = NULL;
 	int opt = 0;
 	int optflag = 0;	
 	
@@ -86,7 +88,22 @@
 		default:
 	}
 
-	deb_extract(argv[optind], optflag, argument);
+	output_buffer = deb_extract(argv[optind], optflag, argument, NULL);
+
+	if (optflag & extract_field) {
+		char *field = NULL;
+		int field_length = 0;
+		int field_start = 0;
+
+		while ((field = read_package_field(&output_buffer[field_start])) != NULL) {
+			field_length = strlen(field);
+			field_start += (field_length + 1);
+			if (strstr(field, argument) == field) {
+				printf("%s\n", field + strlen(argument) + 2);
+			}
+			free(field);
+		}
+	}
 
 	return(EXIT_SUCCESS);
 }
diff --git a/dpkg.c b/dpkg.c
index d0728d9..0d2b2dc 100644
--- a/dpkg.c
+++ b/dpkg.c
@@ -20,7 +20,7 @@
 #define DODEPENDS 1
 
 /* Should we do debugging? */
-//#define DODEBUG 1
+#define DODEBUG 0
 
 #ifdef DODEBUG
 #define SYSTEM(x) do_system(x)
@@ -32,63 +32,68 @@
 
 /* from dpkg-deb.c */
 
-static const int dpkg_deb_contents = 1;
-static const int dpkg_deb_control = 2;
-//	const int dpkg_deb_info = 4;
-static const int dpkg_deb_extract = 8;
-static const int dpkg_deb_verbose_extract = 16;
-static const int dpkg_deb_list = 32;
-
 static const char statusfile[] = "/var/lib/dpkg/status.udeb";
 static const char new_statusfile[] = "/var/lib/dpkg/status.udeb.new";
 static const char bak_statusfile[] = "/var/lib/dpkg/status.udeb.bak";
 
-static const char dpkgcidir[] = "/var/lib/dpkg/tmp.ci/";
-
 static const char infodir[] = "/var/lib/dpkg/info/";
 static const char udpkg_quiet[] = "UDPKG_QUIET";
 
 //static const int status_want_unknown	= 1;
-static const int status_want_install	= 2;
-//static const int status_want_hold	= 3;
-//static const int status_want_deinstall	= 4;
-//static const int status_want_purge	= 5;
+static const int state_want_install	= 2;
+//static const int state_want_hold	= 3;
+//static const int state_want_deinstall	= 4;
+//static const int state_want_purge	= 5;
 
-static const int status_flag_ok	= 1;
-//static const int status_flag_reinstreq = 2; 
-//static const int status_flag_hold	= 3;
-//static const int status_flag_holdreinstreq = 4;
+static const int state_flag_ok	= 1;
+//static const int state_flag_reinstreq = 2; 
+//static const int state_flag_hold	= 3;
+//static const int state_flag_holdreinstreq = 4;
 
-//static const int status_statusnoninstalled = 1;
-static const int status_status_unpacked	= 2;
-static const int status_status_halfconfigured = 3; 
-static const int status_status_installed	= 4;
-static const int status_status_halfinstalled	= 5;
-//static const int status_statusconfigfiles	= 6;
-//static const int status_statuspostinstfailed	= 7;
-//static const int status_statusremovalfailed	= 8;
+//static const int state_statusnoninstalled = 1;
+static const int state_status_unpacked	= 2;
+static const int state_status_halfconfigured = 3; 
+static const int state_status_installed	= 4;
+static const int state_status_halfinstalled	= 5;
+//static const int state_statusconfigfiles	= 6;
+//static const int state_statuspostinstfailed	= 7;
+//static const int state_statusremovalfailed	= 8;
 
-static const char *status_words_want[] = { "unknown", "install", "hold", "deinstall", "purge", 0 };
-static const char *status_words_flag[] = { "ok", "reinstreq", "hold", "hold-reinstreq", 0 };
-static const char *status_words_status[] = { "not-installed", "unpacked", "half-configured", "installed", 
+static const char *state_words_want[] = { "unknown", "install", "hold", "deinstall", "purge", 0 };
+static const char *state_words_flag[] = { "ok", "reinstreq", "hold", "hold-reinstreq", 0 };
+static const char *state_words_status[] = { "not-installed", "unpacked", "half-configured", "installed", 
 		"half-installed", "config-files", "post-inst-failed", "removal-failed", 0 };
 
 static const int color_white	= 0;
 static const int color_grey	= 1;
 static const int color_black	= 2;
 
-/* data structures */
+/* data structures */ 
 typedef struct package_s {
-	char *file;
+	char *filename;
 	char *package;
-	char *version;
+	unsigned char state_want;
+	unsigned char state_flag;
+	unsigned char state_status;
 	char *depends;
 	char *provides;
 	char *description;
+	char *priority;
+	char *section;
+	char *installed_size;
+	char *maintainer;
+	char *source;
+	char *version;
+	char *pre_depends;
+	char *replaces;
+	char *recommends;
+	char *suggests;
+	char *conflicts;
+	char *conffiles;
+	char *long_description;
+	char *architecture;
+	char *md5sum;
 	int installer_menu_item;
-	unsigned char status_want;
-	unsigned char status_flag;
-	unsigned char status_status;
 	char color; /* for topo-sort */
 	struct package_s *requiredfor[DEPENDSMAX]; 
 	unsigned short requiredcount;
@@ -265,8 +270,8 @@
 			/* Check for dependencies; first look for installed packages */
 			dependpkg.package = dependsvec[i];
 			if (((found = tfind(&dependpkg, &status, package_compare)) == 0) ||
-			    ((chk = *(package_t **)found) && (chk->status_flag & status_flag_ok) &&
-				(chk->status_status & status_status_installed))) {
+			    ((chk = *(package_t **)found) && (chk->state_flag & state_flag_ok) &&
+				(chk->state_status & state_status_installed))) {
 
 				/* if it fails, we look through the list of packages we are going to 
 				 * install */
@@ -328,47 +333,100 @@
 }
 
 /*
- * Read a control file (or a stanza of a status file) and parse it,
+ * Read the buffered control file and parse it,
  * filling parsed fields into the package structure
  */
-static int control_read(FILE *file, package_t *p)
+static int fill_package_struct(package_t *package, const char *package_buffer)
 {
-	char *line;
+	char *field = NULL;
+	int field_start = 0;
+	int field_length = 0;
+	while ((field = read_package_field(&package_buffer[field_start])) != NULL) {
+		field_length = strlen(field);
+		field_start += (field_length + 1);
 
-	while ((line = get_line_from_file(file)) != NULL) {
-		line[strlen(line) - 1] = '\0';
-
-		if (strlen(line) == 0) {
+		if (strlen(field) == 0) {
+			printf("empty line: *this shouldnt happen i dont think*\n");
 			break;
 		}
-		else if (strstr(line, "Package: ") == line) {
-				p->package = xstrdup(line + 9);
+
+		/* these are common to both installed and uninstalled packages */
+		if (strstr(field, "Package: ") == field) {
+			package->package = strdup(field + 9);
 		}
-		else if (strstr(line, "Status: ") == line) {
-				char *word_pointer;
-				word_pointer = strchr(line, ' ') + 1;
-				p->status_want = status_parse(word_pointer, status_words_want);
-				word_pointer = strchr(word_pointer, ' ') + 1;
-				p->status_flag = status_parse(word_pointer, status_words_flag);
-				word_pointer = strchr(word_pointer, ' ') + 1;
-				p->status_status = status_parse(word_pointer, status_words_status);
+		else if (strstr(field, "Depends: ") == field) {
+			package->depends = strdup(field + 9);
 		}
-		else if (strstr(line, "Depends: ") == line) {
-				p->depends = xstrdup(line + 9);
+		else if (strstr(field, "Provides: ") == field) {
+			package->provides = strdup(field + 10);
 		}
-		else if (strstr(line, "Provides: ") == line) {
-				p->provides = xstrdup(line + 10);
-		}
-		else if (strstr(line, "Description: ") == line) {
-				p->description = xstrdup(line + 13);
 		/* This is specific to the Debian Installer. Ifdef? */
+		else if (strstr(field, "installer-menu-item: ") == field) {
+			package->installer_menu_item = atoi(field + 21);
 		}
-		else if (strstr(line, "installer-menu-item: ") == line) {
-				p->installer_menu_item = atoi(line + 21);
+		else if (strstr(field, "Description: ") == field) {
+			package->description = strdup(field + 13);
 		}
-		/* TODO: localized descriptions */
+		else if (strstr(field, "Priority: ") == field) {
+			package->priority = strdup(field + 10);
+		}
+		else if (strstr(field, "Section: ") == field) {
+			package->section = strdup(field + 9);
+		}
+		else if (strstr(field, "Installed-Size: ") == field) {
+			package->installed_size = strdup(field + 16);
+		}
+		else if (strstr(field, "Maintainer: ") == field) {
+			package->maintainer = strdup(field + 12);
+		}
+		else if (strstr(field, "Version: ") == field) {
+			package->version = strdup(field + 9);
+		}
+		else if (strstr(field, "Suggests: ") == field) {
+			package->suggests = strdup(field + 10);
+		}
+		else if (strstr(field, "Recommends: ") == field) {
+			package->recommends = strdup(field + 12);
+		}
+/*		else if (strstr(field, "Conffiles: ") == field) {
+			package->conffiles = read_block(file);
+				package->conffiles = xcalloc(1, 1);
+				while ((field = strtok(NULL, "\n")) != NULL) {
+					package->long_description = xrealloc(package->conffiles, 
+					strlen(package->conffiles) + strlen(field) + 1);
+					strcat(package->conffiles, field);
+				}
+			}
+*/
+		/* These are only in available file */
+		else if (strstr(field, "Architecture: ") == field) {
+			package->architecture = strdup(field + 14);
+		}
+		else if (strstr(field, "Filename: ") == field) {
+			package->filename = strdup(field + 10);
+		}
+		else if (strstr(field, "MD5sum ") == field) {
+			package->md5sum = strdup(field + 7);
+		}
+
+		/* This is only needed for status file */
+		if (strstr(field, "Status: ") == field) {
+			char *word_pointer;
+
+			word_pointer = strchr(field, ' ') + 1;
+			package->state_want = status_parse(word_pointer, state_words_want);
+			word_pointer = strchr(word_pointer, ' ') + 1;
+			package->state_flag = status_parse(word_pointer, state_words_flag);
+			word_pointer = strchr(word_pointer, ' ') + 1;
+			package->state_status = status_parse(word_pointer, state_words_status);
+		} else {
+			package->state_want = status_parse("purge", state_words_want);
+			package->state_flag = status_parse("ok", state_words_flag);
+			package->state_status = status_parse("not-installed", state_words_status);
+		}
+
+		free(field);
 	}
-	free(line);
 	return EXIT_SUCCESS;
 }
 
@@ -377,6 +435,7 @@
 	FILE *f;
 	void *status = 0;
 	package_t *m = 0, *p = 0, *t = 0;
+	char *package_control_buffer = NULL;
 
 	if (getenv(udpkg_quiet) == NULL) {
 		printf("(Reading database...)\n");
@@ -386,9 +445,11 @@
 		return(NULL);
 	}
 
-	while (!feof(f)) {
+	while ( (package_control_buffer = read_text_file_to_buffer(f)) != NULL) {
 		m = (package_t *)xcalloc(1, sizeof(package_t));
-		control_read(f, m);
+		printf("read buffer [%s]\n", package_control_buffer);
+		fill_package_struct(m, package_control_buffer);
+		printf("package is [%s]\n", m->package);
 		if (m->package) {
 			/*
 			 * If there is an item in the tree by this name,
@@ -418,9 +479,9 @@
 					 * packages of different statuses
 				 	 * provide it).
 				 	 */
-					t->status_want = m->status_want;
-					t->status_flag = m->status_flag;
-					t->status_status = m->status_status;
+					t->state_want = m->state_want;
+					t->state_flag = m->state_flag;
+					t->state_status = m->state_status;
 				}
 			}
 		}
@@ -428,6 +489,7 @@
 			free(m);
 		}
 	}
+	printf("done\n");
 	fclose(f);
 	return status;
 }
@@ -479,9 +541,9 @@
 			}
 			if (strstr(line, "Status: ") == line && statpkg != 0) {
 				snprintf(line, sizeof(line), "Status: %s %s %s",
-					status_words_want[statpkg->status_want - 1], 
-					status_words_flag[statpkg->status_flag - 1], 
-					status_words_status[statpkg->status_status - 1]);
+					state_words_want[statpkg->state_want - 1], 
+					state_words_flag[statpkg->state_flag - 1], 
+					state_words_status[statpkg->state_status - 1]);
 			}
 			fprintf(fout, "%s\n", line);
 		}
@@ -492,9 +554,9 @@
 	// Print out packages we processed.
 	for (pkg = pkgs; pkg != 0; pkg = pkg->next) {
 		fprintf(fout, "Package: %s\nStatus: %s %s %s\n", 
-			pkg->package, status_words_want[pkg->status_want - 1],
-				status_words_flag[pkg->status_flag - 1],
-				status_words_status[pkg->status_status - 1]);
+			pkg->package, state_words_want[pkg->state_want - 1],
+				state_words_flag[pkg->state_flag - 1],
+				state_words_status[pkg->state_status - 1]);
 
 		if (pkg->depends)
 			fprintf(fout, "Depends: %s\n", pkg->depends);
@@ -544,144 +606,68 @@
 	char buf[1024];
 
 	DPRINTF("Configuring %s\n", pkg->package);
-	pkg->status_status = 0;
+	pkg->state_status = 0;
 	snprintf(postinst, sizeof(postinst), "%s%s.postinst", infodir, pkg->package);
 
 	if (is_file(postinst)) {
 		snprintf(buf, sizeof(buf), "%s configure", postinst);
 		if ((r = do_system(buf)) != 0) {
 			error_msg("postinst exited with status %d\n", r);
-			pkg->status_status = status_status_halfconfigured;
+			pkg->state_status = state_status_halfconfigured;
 			return 1;
 		}
 	}
-	pkg->status_status = status_status_installed;
+	pkg->state_status = state_status_installed;
 	
 	return 0;
 }
 
 static int dpkg_dounpack(package_t *pkg)
 {
-	int r = 0, i;
+	int r = 0;
 	int status = TRUE;
-	char *cwd = xgetcwd(0);
-	char *src_filename = NULL;
-	char *dst_filename = NULL;
-//	char *lst_file = NULL;
-	char *adminscripts[] = { "prerm", "postrm", "preinst", "postinst",
-			"conffiles", "md5sums", "shlibs", "templates" };
+	char *lst_path;
 
 	DPRINTF("Unpacking %s\n", pkg->package);
 
-	if(cwd==NULL)
-		exit(EXIT_FAILURE);
-	chdir("/");
-	deb_extract(pkg->file, dpkg_deb_extract, "/");
+	/* extract the data file */
+	deb_extract(pkg->filename, extract_extract, "/", NULL);
 
-	/* Installs the package scripts into the info directory */
-	for (i = 0; i < sizeof(adminscripts) / sizeof(adminscripts[0]); i++) {
-		struct stat src_stat_buf;
-		FILE *src_file = NULL, *dst_file = NULL;
+	/* extract the control files */
+	deb_extract(pkg->filename, extract_control, infodir, pkg->package);
 
-		/* The full path of the current location of the admin file */
-		src_filename = xrealloc(src_filename, strlen(dpkgcidir) + strlen(pkg->package) + strlen(adminscripts[i]) + 1);
-		sprintf(src_filename, "%s%s/%s", dpkgcidir, pkg->package, adminscripts[i]);
+	/* Create the list file */
+	lst_path = xmalloc(strlen(infodir) + strlen(pkg->package) + 6);
+	strcpy(lst_path, infodir);
+	strcat(lst_path, pkg->package);
+	strcat(lst_path, ".list");
+	deb_extract(pkg->filename, extract_contents_to_file, lst_path, NULL);
 
-		/* the full path of where we want the file to be copied to */
-		dst_filename = xrealloc(dst_filename, strlen(infodir) + strlen(pkg->package) + strlen(adminscripts[i]) + 1);
-		sprintf(dst_filename, "%s%s.%s", infodir, pkg->package, adminscripts[i]);
-
-		/*
-		 * copy admin file to permanent home
-		 * NOTE: Maybe merge this behaviour into libb/copy_file.c
-		 */
-		if (lstat(src_filename, &src_stat_buf) == 0) {
-			if ((src_file = wfopen(src_filename, "r")) != NULL) {
-			 	if ((dst_file = wfopen(dst_filename, "w")) == NULL) {
-					status = FALSE;
-					perror_msg("Opening %s", dst_filename);
-				}
-				copy_file_chunk(src_file, dst_file, src_stat_buf.st_size);
-				fclose(src_file);
-				fclose(dst_file);
-			} else {
-				status = FALSE;
-				error_msg("couldnt open [%s]\n", src_filename);
-			}
-		}
-	}
-
-	/* 
-	 * create the list file 
-	 * FIXME: currently this dumps the lst to stdout instead of a file
-	 */
-/*	lst_file = (char *) xmalloc(strlen(infodir) + strlen(pkg->package) + 6);
-	strcpy(lst_file, infodir);
-	strcat(lst_file, pkg->package);
-	strcat(lst_file, ".list");
-	deb_extract(dpkg_deb_list, NULL, pkg->file);
-*/
-
-	pkg->status_want = status_want_install;
-	pkg->status_flag = status_flag_ok;
+	pkg->state_want = state_want_install;
+	pkg->state_flag = state_flag_ok;
  
 	if (status == TRUE) {
-		pkg->status_status = status_status_unpacked;
+		pkg->state_status = state_status_unpacked;
 	} else {
-		pkg->status_status = status_status_halfinstalled;
+		pkg->state_status = state_status_halfinstalled;
 	}
 
-	chdir(cwd);
 	return r;
 }
 
 /*
- * Extract and parse the control.tar.gz from the specified package
+ * Extract and parse the control file from control.tar.gz
  */
-static int dpkg_unpackcontrol(package_t *pkg)
+static int dpkg_read_control(package_t *pkg)
 {
-	char *tmp_name;
-	FILE *file;
-	int length;
+	FILE *pkg_file;
+	char *control_buffer = NULL;
 
-	/* clean the temp directory (dpkgcidir) be recreating it */
-	remove_dir(dpkgcidir);
-	if (create_path(dpkgcidir, S_IRWXU) == FALSE) {
+	if ((pkg_file = wfopen(pkg->filename, "r")) == NULL) {
 		return EXIT_FAILURE;
 	}
-
-	/*
-	 * Get the package name from the file name,
-	 * first remove the directories
-	 */
-	if ((tmp_name = strrchr(pkg->file, '/')) == NULL) {
-		tmp_name = pkg->file;
-	} else {
-		tmp_name++;
-	}
-	/* now remove trailing version numbers etc */
-	length = strcspn(tmp_name, "_.");
-	pkg->package = (char *) xcalloc(1, length + 1);
-	/* store the package name */
-	strncpy(pkg->package, tmp_name, length);
-
-	/* work out the full extraction path */
-	tmp_name = (char *) xcalloc(1, strlen(dpkgcidir) + strlen(pkg->package) + 9);
-	strcpy(tmp_name, dpkgcidir);
-	strcat(tmp_name, pkg->package);
-
-	/* extract control.tar.gz to the full extraction path */
-	deb_extract(pkg->file, dpkg_deb_control, tmp_name);
-
-	/* parse the extracted control file */
-	strcat(tmp_name, "/control");
-	if ((file = wfopen(tmp_name, "r")) == NULL) {
-		return EXIT_FAILURE;
-	}
-	if (control_read(file, pkg) == EXIT_FAILURE) {
-		return EXIT_FAILURE;
-	}
-
+	control_buffer = deb_extract(pkg->filename, extract_field, NULL, NULL);
+	fill_package_struct(pkg, control_buffer);
 	return EXIT_SUCCESS;
 }
 
@@ -691,15 +677,12 @@
 	package_t *pkg;
 
 	for (pkg = pkgs; pkg != 0; pkg = pkg->next) {
-		if (dpkg_unpackcontrol(pkg) == EXIT_FAILURE) {
-			return EXIT_FAILURE;
-		}
+		dpkg_read_control(pkg);
 		if ((r = dpkg_dounpack(pkg)) != 0 ) {
 			break;
 		}
 	}
 	status_merge(status, pkgs);
-	remove_dir(dpkgcidir);
 
 	return r;
 }
@@ -735,9 +718,7 @@
 
 	/* Stage 1: parse all the control information */
 	for (p = pkgs; p != 0; p = p->next) {
-		if (dpkg_unpackcontrol(p) == EXIT_FAILURE) {
-			return(EXIT_FAILURE);
-		}
+		dpkg_read_control(p);
 	}
 
 	/* Stage 2: resolve dependencies */
@@ -749,27 +730,26 @@
 	
 	/* Stage 3: install */
 	for (p = ordered; p != 0; p = p->next) {
-		p->status_want = status_want_install;
+		p->state_want = state_want_install;
 
 		/* for now the flag is always set to ok... this is probably
 		 * not what we want
 		 */
-		p->status_flag = status_flag_ok;
+		p->state_flag = state_flag_ok;
 
 		DPRINTF("Installing %s\n", p->package);
 		if (dpkg_dounpack(p) != 0) {
-			perror_msg(p->file);
+			perror_msg(p->filename);
 		}
 
 		if (dpkg_doconfigure(p) != 0) {
-			perror_msg(p->file);
+			perror_msg(p->filename);
 		}
 	}
 
 	if (ordered != 0) {
 		status_merge(status, pkgs);
 	}
-	remove_dir(dpkgcidir);
 
 	return 0;
 }
@@ -822,7 +802,7 @@
 		if (optflag & arg_configure) {
 			p->package = xstrdup(argv[optind]);
 		} else {
-			p->file = xstrdup(argv[optind]);
+			p->filename = xstrdup(argv[optind]);
 		}
 		p->next = packages;
 		packages = p;
@@ -830,7 +810,6 @@
 		optind++;
 	}
 
-	create_path(dpkgcidir, S_IRWXU);
 	create_path(infodir, S_IRWXU);
 
 	status = status_read();
diff --git a/dpkg_deb.c b/dpkg_deb.c
index 7c5a5de..d088828 100644
--- a/dpkg_deb.c
+++ b/dpkg_deb.c
@@ -15,12 +15,14 @@
  */
 
 #include <stdlib.h>
+#include <string.h>
 #include <getopt.h>
 #include "busybox.h"
 
 extern int dpkg_deb_main(int argc, char **argv)
 {
 	char *argument = NULL;
+	char *output_buffer = NULL;
 	int opt = 0;
 	int optflag = 0;	
 	
@@ -86,7 +88,22 @@
 		default:
 	}
 
-	deb_extract(argv[optind], optflag, argument);
+	output_buffer = deb_extract(argv[optind], optflag, argument, NULL);
+
+	if (optflag & extract_field) {
+		char *field = NULL;
+		int field_length = 0;
+		int field_start = 0;
+
+		while ((field = read_package_field(&output_buffer[field_start])) != NULL) {
+			field_length = strlen(field);
+			field_start += (field_length + 1);
+			if (strstr(field, argument) == field) {
+				printf("%s\n", field + strlen(argument) + 2);
+			}
+			free(field);
+		}
+	}
 
 	return(EXIT_SUCCESS);
 }
diff --git a/include/libbb.h b/include/libbb.h
index 569ed93..4b06ad1 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -236,10 +236,13 @@
 	extract_verbose_extract = 16,
 	extract_list = 32,
 	extract_fsys_tarfile = 64,
-	extract_field = 128
+	extract_field = 128,
+	extract_contents_to_file = 256
 } extract_function_t;
-extern int deb_extract(const char *package_filename, int function, char *target_dir);
-extern char *untar(FILE *src_tar_file, FILE *output, const int untar_function, const char *argument);
+extern char *deb_extract(const char *package_filename, const int function,
+	const char *argument, const char *argument2);
+extern char *untar(FILE *src_tar_file, FILE *output, const int untar_function,
+	const char *argument, const char *file_prefix);
 extern char *read_text_file_to_buffer(FILE *src_file);
 extern char *read_package_field(const char *package_buffer);
 
diff --git a/libbb/deb_extract.c b/libbb/deb_extract.c
index b95dfa4..36cebfa 100644
--- a/libbb/deb_extract.c
+++ b/libbb/deb_extract.c
@@ -34,12 +34,13 @@
  * The contents of argument depend on the value of function.
  * It is either a dir name or a control file or field name(see dpkg_deb.c)
  */
-extern int deb_extract(const char *package_filename, int function, char *argument)
+extern char *deb_extract(const char *package_filename, const int function, const char *argument, const char *argument2)
 {
 
 	FILE *deb_file, *uncompressed_file;
 	ar_headers_t *headers = NULL;
 	char *ared_file = NULL;
+	char *output_buffer = NULL;
 	int gunzip_pid;
 
 	switch (function) {
@@ -61,7 +62,7 @@
 	/* get a linked list of all ar entries */
 	if ((headers = get_ar_headers(deb_file)) == NULL) {
 		error_msg("Couldnt get ar headers\n");
-		return(EXIT_FAILURE);
+		return(NULL);
 	}
 
 	/* seek to the start of the .tar.gz file within the ar file*/
@@ -75,27 +76,23 @@
 	if (function & extract_fsys_tarfile) {
 		copy_file_chunk(uncompressed_file, stdout, -1);
 	} else {
-		char *output_buffer = NULL;
-		output_buffer = untar(uncompressed_file, stdout, function, argument);
-		if (function & extract_field) {
-			char *field = NULL;
-			int field_length = 0;
-			int field_start = 0;
-			while ((field = read_package_field(&output_buffer[field_start])) != NULL) {
-				field_length = strlen(field);
-				field_start += (field_length + 1);
-				if (strstr(field, argument) == field) {
-					printf("%s\n", field + strlen(argument) + 2);
-				}
-				free(field);
-			}
+		FILE *output;
+
+		if (function & extract_contents_to_file) {
+			output = wfopen(argument, "w");
+		} else {
+			output = stdout;
+		}
+
+		output_buffer = untar(uncompressed_file, output, function, argument, argument2);
+		if (output != stdout) {
+			fclose(output);
 		}
 	}
-
 	gz_close(gunzip_pid);
 	fclose(deb_file);
 	fclose(uncompressed_file);
 	free(ared_file);
 
-	return(EXIT_SUCCESS);
+	return(output_buffer);
 }
\ No newline at end of file
diff --git a/libbb/libbb.h b/libbb/libbb.h
index 569ed93..4b06ad1 100644
--- a/libbb/libbb.h
+++ b/libbb/libbb.h
@@ -236,10 +236,13 @@
 	extract_verbose_extract = 16,
 	extract_list = 32,
 	extract_fsys_tarfile = 64,
-	extract_field = 128
+	extract_field = 128,
+	extract_contents_to_file = 256
 } extract_function_t;
-extern int deb_extract(const char *package_filename, int function, char *target_dir);
-extern char *untar(FILE *src_tar_file, FILE *output, const int untar_function, const char *argument);
+extern char *deb_extract(const char *package_filename, const int function,
+	const char *argument, const char *argument2);
+extern char *untar(FILE *src_tar_file, FILE *output, const int untar_function,
+	const char *argument, const char *file_prefix);
 extern char *read_text_file_to_buffer(FILE *src_file);
 extern char *read_package_field(const char *package_buffer);
 
diff --git a/libbb/untar.c b/libbb/untar.c
index e70032c..a77d94f 100644
--- a/libbb/untar.c
+++ b/libbb/untar.c
@@ -22,7 +22,8 @@
 #include <unistd.h>
 #include "libbb.h"
 
-extern char *untar(FILE *src_tar_file, FILE *output, const int untar_function, const char *argument)
+extern char *untar(FILE *src_tar_file, FILE *output, const int untar_function,
+	const char *argument, const char *file_prefix)
 {
 	typedef struct raw_tar_header {
         char name[100];               /*   0-99 */
@@ -102,7 +103,21 @@
 			next_header_offset += (512 - size % 512);
 		}
 
-		if (untar_function & (extract_contents | extract_verbose_extract)) {
+		/* If an exclude list is specified check current file against list 
+		if (*exclude_list != NULL) {
+			i = 0;
+			while (exclude_list[i] != 0) {
+				if (strncmp(exclude_list[i], raw_tar_header.name, strlen(raw_tar_header.name)) == 0) {
+					break;
+				}
+				i++;
+			}
+		if (exclude_list[i] != 0) {
+				continue;
+			}
+		} */
+
+		if (untar_function & (extract_contents | extract_verbose_extract | extract_contents_to_file)) {
 			fprintf(output, "%s\n", raw_tar_header.name);
 		}
 
@@ -123,10 +138,29 @@
 						case (extract_extract):
 						case (extract_verbose_extract):
 						case (extract_control): {
-								FILE *dst_file = wfopen(dir, "w");
+								FILE *dst_file = NULL;
+								char *full_name;
+
+								if (file_prefix != NULL) {
+									char *file_name = NULL, *file_extension = NULL;
+
+									file_extension = xmalloc(strlen(raw_tar_header.name) + 1);
+									file_extension = strrchr(raw_tar_header.name, '/');
+									file_extension++;
+									file_name = xmalloc(strlen(file_prefix) + strlen(file_extension) + 2);
+									strcpy(file_name, file_prefix);
+									strcat(file_name, ".");
+									strcat(file_name, file_extension);
+
+									full_name = concat_path_file(strndup(dir, strlen(dir) - strlen(strrchr(dir, '/'))), file_name);
+								} else {
+									full_name = xstrdup(dir);
+								}
+								dst_file = wfopen(full_name, "w");
 								copy_file_chunk(src_tar_file, dst_file, (unsigned long long) size);
 								uncompressed_count += size;
 								fclose(dst_file);
+								chmod(full_name, mode);
 							}
 							break;
 						case (extract_info):
@@ -136,7 +170,7 @@
 							}
 							break;
 						case (extract_field):
-							if (strstr(raw_tar_header.name, "control") != NULL) {
+							if (strstr(raw_tar_header.name, "./control") != NULL) {
 								return(read_text_file_to_buffer(src_tar_file));
 							}
 							break;
