diff --git a/Example/data/SQL_query_MASTER.sql b/Example/data/SQL_query_MASTER.sql
index 90c5a5c032b5f2e6cb3c8ade248731f918cfa398..ea0c0307a89978cc820df6f0ddca41371a421e7b 100644
--- a/Example/data/SQL_query_MASTER.sql
+++ b/Example/data/SQL_query_MASTER.sql
@@ -1,5 +1,5 @@
 select
-       event.m_publicid as eventid,
+       --event.m_publicid as eventid,
        event.m_type as eventtype,
        prforigin.m_time_value + (prforigin.m_time_value_ms || ' microseconds')::interval as sourcetime,
        round(prforigin.m_latitude_value::numeric, 5)                             as lat,
@@ -49,22 +49,22 @@ from
 
        event inner join origin as prforigin on prforigin.m_publicid         = event.m_preferredoriginid
              
-             -- [OPTION] For counting the number of stations used for automatic magnitude
-             --inner join originreference     on originreference._parent_oid  = event._oid
-             --inner join origin as anyorigin on anyorigin.m_publicid         = originreference.m_originid
+       -- [OPTION] For counting the number of stations used for automatic magnitude
+       --inner join originreference     on originreference._parent_oid  = event._oid
+       --inner join origin as anyorigin on anyorigin.m_publicid         = originreference.m_originid
              
-             -- [OPTION] Magnitude info: preferred one (first line) or all (last two lines)
-             inner join magnitude           on magnitude.m_publicid         = event.m_preferredmagnitudeid  -- Only preferred magnitude
-             --inner join origin              on event.m_preferredoriginid    = origin.m_publicid  -- All magnitude types
-             --inner join magnitude           on magnitude._parent_oid        = origin._oid        -- All magnitude types
+       -- [OPTION] Magnitude info: preferred one (first line) or all (last two lines)
+       inner join magnitude           on magnitude.m_publicid         = event.m_preferredmagnitudeid  -- Only preferred magnitude
+       --inner join origin              on event.m_preferredoriginid    = origin.m_publicid  -- All magnitude types
+       --inner join magnitude           on magnitude._parent_oid        = origin._oid        -- All magnitude types
              
-             left join eventdescription     on eventdescription._parent_oid = event._oid
+       left join eventdescription     on eventdescription._parent_oid = event._oid
              
-             -- [OPTION] Pick times
-             --inner join arrival             on arrival._parent_oid          = prforigin._oid
-             --inner join pick                on arrival.m_pickid             = pick.m_publicid
+       -- [OPTION] Pick times
+       --inner join arrival             on arrival._parent_oid          = prforigin._oid
+       --inner join pick                on arrival.m_pickid             = pick.m_publicid
 
-where  
+where
        --(eventdescription.m_text ~ 'BASEL' or eventdescription.m_text ~ 'Basel')
        
        ST_Distance (
@@ -87,8 +87,8 @@ where
        --and pick.m_waveformid_stationcode = 'OTER2' and arrival.m_phase_code ~ 'P'
 
 --group by
---       event.m_publicid,
---       event.m_type,
+--       --event.m_publicid,
+--       eventtype,
 --       prforigin.m_time_value,
 --       prforigin.m_time_value + (prforigin.m_time_value_ms || ' microseconds')::interval, 
 --       prforigin.m_latitude_value, 
@@ -116,4 +116,3 @@ where
 order by
        prforigin.m_time_value asc;
        --prforigin.m_time_value, pick.m_time_value;
-
diff --git a/scripts/plotTimeline.sh b/scripts/plotTimeline.sh
index 999762fcb8f84a5c90e88e77e328df7f42262375..ee634aed451924321b036c564106036921d0c142 100755
--- a/scripts/plotTimeline.sh
+++ b/scripts/plotTimeline.sh
@@ -217,31 +217,31 @@ case "$THEME" in
 
 	scientific|web)
 		# Catalog events as a gray ring
-		awk '{print $2, $5, ($5+2)/7+.05}' $DIR/regression_catalogALL.dat | sort -nrk2,2 |\
+		awk '{print $2, $5, ($5+2)/7+.05}' "$DIR/regression_catalogALL.dat" | sort -nrk2,2 |\
 			gmt gmtselect -R -J |\
 			gmt psxy -R -J -N -Sc -Wfatter,$colSED -O -K >> $out.ps
 
 		#  Catalog events as missed events (will be visible if not overplot by detection)
-		awk '{print $2, $5, ($5+2)/7+.05}' $DIR/regression_catalogALL.dat | sort -nrk2,2 |\
+		awk '{print $2, $5, ($5+2)/7+.05}' "$DIR/regression_catalogALL.dat" | sort -nrk2,2 |\
 			gmt gmtselect -R -J |\
 			gmt psxy -R -J -N -Sc -Wthinnest,black -G$colSED -O -K >> $out.ps
 		;;
 
 	basel|basel_pressure)
 		# SED catalog events
-		awk '{print $2, $5, ($5+2)/7+.05}' $DIR/regression_SEDcatalogALL.dat | sort -nrk2,2 |\
+		awk '{print $2, $5, ($5+2)/7+.05}' "$DIR/regression_SEDcatalogALL.dat" | sort -nrk2,2 |\
 			gmt gmtselect -R -J |\
 			gmt psxy -R -J -N -Sc -Wfatter,$colSED -O -K >> $out.ps
 		# GEL catalog events
-		awk '{print $2, $5, ($5+2)/7+.05}' $DIR/regression_GELcatalogALL.dat | sort -nrk2,2 |\
+		awk '{print $2, $5, ($5+2)/7+.05}' "$DIR/regression_GELcatalogALL.dat" | sort -nrk2,2 |\
 			gmt gmtselect -R -J |\
 			gmt psxy -R -J -N -Sc -Wfat,$colGEL -O -K >> $out.ps
 		
 		#  Catalog events as missed events (will be visible if not overplot by detection)
-		awk '{print $2, $5, ($5+2)/7+.05}' $DIR/regression_SEDcatalogALL.dat | sort -nrk2,2 |\
+		awk '{print $2, $5, ($5+2)/7+.05}' "$DIR/regression_SEDcatalogALL.dat" | sort -nrk2,2 |\
 			gmt gmtselect -R -J |\
 			gmt psxy -R -J -N -Sc -Wthinnest,black -G$colSED -O -K >> $out.ps
-		awk '{print $2, $5, ($5+2)/7+.05}' $DIR/regression_GELcatalogALL.dat | sort -nrk2,2 |\
+		awk '{print $2, $5, ($5+2)/7+.05}' "$DIR/regression_GELcatalogALL.dat" | sort -nrk2,2 |\
 			gmt gmtselect -R -J |\
 			gmt psxy -R -J -N -Sc -Wthinnest,black -G$colGEL -O -K >> $out.ps
 		;;
@@ -257,7 +257,7 @@ esac
 # Variant 2: with custom order
 # Expl: As long as in file1 (NR==FNR), write $2 into array A with $1 as ID. If reading file2 and if ID in array ($4 in A), write out desired fields + array element for ID
 awk 'NR==FNR{A[$1]=$2;next}
-	($4 in A){print $1, $3, substr(A[$4],3), ($3+2)/7+.05}' $DIR/timeline_template_order.dat $FILENAME | sort -nrk2,2 |\
+	($4 in A){print $1, $3, substr(A[$4],3), ($3+2)/7+.05}' "$DIR/timeline_template_order.dat" "$FILENAME" | sort -nrk2,2 |\
 	gmt gmtselect -R -J |\
 	gmt psxy -R -J -N -Sc -Wthinnest,black -C$COLORMAP -O -K >> $out.ps
 
@@ -273,12 +273,12 @@ awk 'NR==FNR{A[$1]=$2;next}
 
 # Variant 2: with custom order
 awk 'NR==FNR{A[substr($1,3)]=$2;next}
-	{print $1, $3, substr(A[FNR],3), ($3+2)/7+.05}' $DIR/timeline_template_order.dat $DIR/regression_templates.dat |\
+	{print $1, $3, substr(A[FNR],3), ($3+2)/7+.05}' "$DIR/timeline_template_order.dat" "$DIR/regression_templates.dat" |\
 	sort -nrk2,2 |\
 	gmt gmtselect -R -J |\
 	gmt psxy -R -J -N -Sc -Wthinnest,black -Gblue -C$COLORMAP -diNaN -O -K >> $out.ps
 awk 'NR==FNR{A[substr($1,3)]=$2;next}
-	{print $1, $3, substr(A[FNR],3)}' $DIR/timeline_template_order.dat $DIR/regression_templates.dat |\
+	{print $1, $3, substr(A[FNR],3)}' "$DIR/timeline_template_order.dat" "$DIR/regression_templates.dat" |\
 	gmt gmtselect -R -J |\
 	gmt pstext -R -J -N -F+f14,Helvetica,black+jCM -O -K >> $out.ps
 
@@ -304,7 +304,7 @@ case "$THEME" in
 		# Legend text - Variant 2: from custom order
 		# Expl: Write the Legend Text into array A with template number as ID. Later, loop over template numbers
 		awk '{tpNum=substr($2,3); A[tpNum]=$3}
-			 END{for (i=1;i<=numTEMPL;i++){print ".8", (numTEMPL-i+1)/(numTEMPL+1), A[i]} }' numTEMPL=$numTEMPLATES $DIR/timeline_template_order.dat |\
+			 END{for (i=1;i<=numTEMPL;i++){print ".8", (numTEMPL-i+1)/(numTEMPL+1), A[i]} }' numTEMPL=$numTEMPLATES "$DIR/timeline_template_order.dat" |\
 			gmt pstext -R -J -F+f10,Helvetica,black+jRM -O -K >> $out.ps
 		;;
 
@@ -338,18 +338,18 @@ case "$THEME" in
 
 	*)
 		# Histogram
-		awk '$3>-3 { print $1 }' $FILENAME |\
+		awk '$3>-3 { print $1 }' "$FILENAME" |\
 			gmt pshistogram -JX25T/5 $RDate/0/$maxDailyEQ -Xf1i -Yf5.33i -W$bin -fi0T \
 				$annotHistX -Bya$HistTICK''f$HistTICKminor+l"@;black;No. events in $bin h@;;" -BnsW -Gblack -O -K >> $out.ps
 		# -F
 
 		# Cumulative line
-		awk '$3>-3 { print $1 }' $FILENAME |\
+		awk '$3>-3 { print $1 }' "$FILENAME" |\
 			gmt pshistogram -JX25T/5 $RDate/0/$numEQ -fi0T -F \
 				-Bya$CumTICK''f$CumTICKminor+l"@;"$colALL";cumulative no. EQs@;;" -BnsE -Lthicker,$colALL -S -Q -W.1 -O -K >> $out.ps
 
 		# Cumulative line [catalog events]
-		awk '$3>-3 { print $2 }' $DIR/regression_catalogALL.dat |\
+		awk '$3>-3 { print $2 }' "$DIR/regression_catalogALL.dat" |\
 			gmt pshistogram -J -R -fi0T -F -Lthicker,$colSED -S -Q -W.1 -O >> $out.ps
 		;;
 esac
@@ -358,14 +358,14 @@ esac
 # -- Convert to PS to PDF + PNG
 
 # 1. PS to PDF
-gmt psconvert $out.ps -A.1c -Tf
+gmt psconvert "$out.ps" -A.1c -Tf
 
 # 2. PS to PNG
 #ps2raster $out.ps -A -Q -Tg -E150 # This looks ugly!
 #rm ps2raster*
 
 # 2. PDF to PNG
-convert -density 100 -flatten -antialias +repage $out.pdf $out.png
+convert -density 100 -flatten -antialias +repage "$out.pdf" "$out.png"
 
 
 # --- Clean up
@@ -373,18 +373,18 @@ convert -density 100 -flatten -antialias +repage $out.pdf $out.png
 case "$IMAGEFORMAT" in
 
 	png)
-	rm $out.pdf
+	rm "$out.pdf"
 	;;
 
 	pdf)
-	rm $out.png
+	rm "$out.png"
 	;;
 
 	# (otherwise, don't delete anything)
 esac
 
-rm $out.ps
-rm $COLORMAP
+rm "$out.ps"
+rm "$COLORMAP"
 rm gmt.conf