diff --git a/include/class.format.php b/include/class.format.php
index 459071018d9425d2df4d794c6ae917e98d74c9ec..4e0ddf9ac257ce1731bbf6f3f674fd61e9d10fed 100644
--- a/include/class.format.php
+++ b/include/class.format.php
@@ -30,10 +30,6 @@ class Format {
         return round(($bytes/1048576),1).' mb';
     }
 
-    function file_name($filename) {
-        return preg_replace('/\s+/', '_', $filename);
-    }
-
     /* encode text into desired encoding - taking into accout charset when available. */
     function encode($text, $charset=null, $encoding='utf-8') {
 
@@ -386,10 +382,6 @@ class Format {
     }
 
 
-    function linebreaks($string) {
-        return urldecode(ereg_replace("%0D", " ", urlencode($string)));
-    }
-
     function viewableImages($html, $script='image.php') {
         return preg_replace_callback('/"cid:([\\w.-]{32})"/',
         function($match) use ($script) {
diff --git a/include/htmLawed.php b/include/htmLawed.php
index 6d25f1f98a714269c3b65d87ca6f3dcb5db96dcb..9d0cc9e95e8210746f52933e0615eb2df29a7275 100644
--- a/include/htmLawed.php
+++ b/include/htmLawed.php
@@ -644,7 +644,7 @@ return '';
 function hl_tidy($t, $w, $p){
 // Tidy/compact HTM
 if(strpos(' pre,script,textarea', "$p,")){return $t;}
-$t = preg_replace('`\s+`', ' ', preg_replace_callback(array('`(<(!\[CDATA\[))(.+?)(\]\]>)`sm', '`(<(!--))(.+?)(-->)`sm', '`(<(pre|script|textarea)[^>]*?>)(.+?)(</\2>)`sm'), create_function('$m', 'return $m[1]. str_replace(array("<", ">", "\n", "\r", "\t", " "), array("\x01", "\x02", "\x03", "\x04", "\x05", "\x07"), $m[3]). $m[4];'), $t));
+$t = preg_replace('`[ \t\r\n\f]+`', ' ', preg_replace_callback(array('`(<(!\[CDATA\[))(.+?)(\]\]>)`sm', '`(<(!--))(.+?)(-->)`sm', '`(<(pre|script|textarea)[^>]*?>)(.+?)(</\2>)`sm'), create_function('$m', 'return $m[1]. str_replace(array("<", ">", "\n", "\r", "\t", " "), array("\x01", "\x02", "\x03", "\x04", "\x05", "\x07"), $m[3]). $m[4];'), $t));
 if(($w = strtolower($w)) == -1){
  return str_replace(array("\x01", "\x02", "\x03", "\x04", "\x05", "\x07"), array('<', '>', "\n", "\r", "\t", ' '), $t);
 }