--- a/nouveau-pm/tools/timestrip.c
+++ b/nouveau-pm/tools/timestrip.c
@@ -1,34 +1,47 @@
-/*
- A small program that removes the timestamp and the map from a dump
- XXX: any possible improvements, possibly replace with script if it is faster
-*/
+#
+# A small program that removes the timestamp in the dump
+# XXX: any possible improvements, possibly replace with script if it is faster
+
 #include <stdio.h>
 #include <string.h>
 
 int main(int argc, char **argv)
 {
 	char infilename[255];
+	char outfilename[255];
 	char mode;
-	FILE *inFile;
+	FILE *inFile, *outFile;
+	int ret;
 	float time;
-	unsigned int r_size, mapid, address, data;
+	unsigned int r_size, w_size, address, data;
 
-	if (argc != 2) {
-		printf("Argument count mismatch\nUsage \"%s file_to_strip\"", argv[0]); 
+	sprintf(infilename,"%s",argv[1]);
+	inFile = fopen( infilename, "r");
+	if ( inFile == NULL)
+	{
+		printf("\nCannot open src file");
+		return(1);
+	}
+	sprintf(outfilename, "%s-timestripped",infilename);
+
+	outFile = fopen( outfilename, "w");
+	if (outFile == NULL )
+	{
+		printf("\nCannot create output file");
+		fclose(inFile);
 		return(1);
 	}
 
-	sprintf(infilename,"%s",argv[1]);
-	inFile = fopen( infilename, "r");
-	if (!inFile) {
-		printf("\nCannot open src file");
-		return(1);
+	ret = fscanf(inFile, "%c %i %f %i %x %x 0x0 0\n", &mode, &r_size, &time, &w_size, &address, &data);
+	while (( ret != 0 ) & ( !feof(inFile)))
+	{
+		fprintf(outFile, "%c %i %i 0x%x 0x%x 0x0 0\n", mode, r_size, w_size, address, data);
+		ret = fscanf(inFile, "%c %i %f %i %x %x 0x0 0\n", &mode, &r_size, &time, &w_size, &address, &data);
 	}
 
-	while ((!feof(inFile)) & (fscanf(inFile, "%c %i %f %i %x %x 0x0 0\n", &mode, &r_size, &time, &mapid, &address, &data) != 0)) {
-		printf("%c %i 0x%x 0x%x 0x0 0\n", mode, r_size, address, data);
-	}
 
 	fclose(inFile);
+	fclose(outFile);
+
 	return 0;
 }