diff --git a/sm/CMakeLists.txt b/sm/CMakeLists.txt
index 5ad869f932757d2b8cd9f73bf7e23fdeec512b99..dbcc19185f03eccfb6811cde02c42583d7597d28 100644
--- a/sm/CMakeLists.txt
+++ b/sm/CMakeLists.txt
@@ -84,6 +84,7 @@ new_executable(sm2)
 new_executable(sm3)
 new_executable(json_extract)
 new_executable(json_extract_field)
+new_executable(json_decimate)
 new_executable(json_split)
 new_executable(json_pipe)
 new_executable(carmen2json)
diff --git a/sm/apps/json_decimate.c b/sm/apps/json_decimate.c
new file mode 100644
index 0000000000000000000000000000000000000000..366722aab7a3f5e0e8de5307590d408b4cb54c14
--- /dev/null
+++ b/sm/apps/json_decimate.c
@@ -0,0 +1,53 @@
+#include <options/options.h>
+#include "../csm/csm_all.h"
+
+int main(int argc, const char * argv[]) {
+	sm_set_program_name(argv[0]);
+	
+	int period;
+	const char*input_filename;
+	const char*output_filename;
+	
+	struct option* ops = options_allocate(3);
+	options_int(ops, "period", &period, 1, "Period of objects to extract.");
+	options_string(ops, "in", &input_filename, "stdin", "input file (JSON)");
+	options_string(ops, "out", &output_filename, "stdout", "output file (JSON)");
+	
+	if(!options_parse_args(ops, argc, argv)) {
+		fprintf(stderr, "%s : decimates a JSON stream."
+			"\n\nOptions:\n", argv[0]);
+		options_print_help(ops, stderr);
+		return -1;
+	}
+	
+	if(period < 1) {
+		sm_error("Period must be >= 1.\n");
+		return 2;
+	}
+	
+	FILE * input_stream = open_file_for_reading(input_filename);
+	FILE *output_stream = open_file_for_writing(output_filename);
+	
+	if(!input_stream || !output_stream) return -1;
+	
+	
+	int count = 0;
+	while(1) { 
+		JO jo = json_read_stream(stdin);
+		if(!jo) {
+			if(feof(stdin)) break;
+			sm_error("Malformed JSON\n");
+			return -1;
+		}
+		
+		if(count % period == 0) {
+			const char * s = json_object_to_json_string(jo);
+			puts(s); puts("\n");
+		} 
+		
+		jo_free(jo);
+		count++;
+	}
+	
+	return 0;
+}
diff --git a/sm/apps/ld_remove_doubles.c b/sm/apps/ld_remove_doubles.c
index ac65fed2d04006a32a0ffebc099ea87c2dbc9ca2..73d594fd76c0ed56ed800675b009965e659bcf78 100644
--- a/sm/apps/ld_remove_doubles.c
+++ b/sm/apps/ld_remove_doubles.c
@@ -10,14 +10,21 @@ int main(int argc, const char*argv[]) {
 	sm_set_program_name(argv[0]);
 	
 	double epsilon;
+	int debug;
+	
 	
 	struct option* ops = options_allocate(3);
-	options_double(ops, "epsilon", &epsilon, 0.0001, "epsilon");
+	options_double(ops, "epsilon", &epsilon, 0.0001, "minimum difference between rays to be used");
+	
+	
 	if(!options_parse_args(ops, argc, argv)) {
 		options_print_help(ops, stderr);
 		return -1;
 	}
 	
+	sm_debug_write(debug);
+	
+	
 	/* Read first scan */
 	LDP laser_ref=0, laser_sens;