  	global $pun_config, $lang_common, $lang_post, $re_list;
  
  	// Remove empty tags
--- 
-1.7.10.1
-
+@@ -880,46 +881,25 @@ function do_smilies($text)
+ //
+ function parse_message($text, $hide_smilies)
+ {
+-	global $pun_config, $lang_common, $pun_user;
++	global $pun_config, $cur_post;
++	static $textile = null;
+ 
+ 	if ($pun_config['o_censoring'] == '1')
++	{
+ 		$text = censor_words($text);
++	}
+ 
+-	// Convert applicable characters to HTML entities
+-	$text = pun_htmlspecialchars($text);
+-
+-	// If the message contains a code tag we have to split it up (text within [code][/code] shouldn't be touched)
+-	if (strpos($text, '[code]') !== false && strpos($text, '[/code]') !== false)
+-		list($inside, $text) = extract_blocks($text, '[code]', '[/code]');
+-
+-	if ($pun_config['p_message_bbcode'] == '1' && strpos($text, '[') !== false && strpos($text, ']') !== false)
+-		$text = do_bbcode($text);
+-
+-	if ($pun_config['o_smilies'] == '1' && $pun_user['show_smilies'] == '1' && $hide_smilies == '0')
+-		$text = do_smilies($text);
+-
+-	// Deal with newlines, tabs and multiple spaces
+-	$pattern = array("\n", "\t", '  ', '  ');
+-	$replace = array('<br />', '&#160; &#160; ', '&#160; ', ' &#160;');
+-	$text = str_replace($pattern, $replace, $text);
++	if ($textile === null)
++    {
++		$textile = new Netcarver\Textile\Parser();
++    }
+ 
+-	// If we split up the message before we have to concatenate it together again (code tags)
+-	if (isset($inside))
++	if (defined('PUN_NEW_MEMBER') && $cur_post['group_id'] == PUN_NEW_MEMBER)
+ 	{
+-		$parts = explode("\1", $text);
+-		$text = '';
+-		foreach ($parts as $i => $part)
+-		{
+-			$text .= $part;
+-			if (isset($inside[$i]))
+-			{
+-				$num_lines = (substr_count($inside[$i], "\n"));
+-				$text .= '</p><div class="codebox"><pre'.(($num_lines > 28) ? ' class="vscroll"' : '').'><code>'.pun_trim($inside[$i], "\n\r").'</code></pre></div><p>';
+-			}
+-		}
++		return $textile->textileRestricted($text, false, true);
+ 	}
+ 
+-	return clean_paragraphs($text);
++	return $textile->textileRestricted($text, false, false);
+ }
+ 
+ 
+@@ -954,25 +934,23 @@ function clean_paragraphs($text)
+ //
+ function parse_signature($text)
+ {
+-	global $pun_config, $lang_common, $pun_user;
++	global $pun_config, $cur_post;
++	static $textile = null;
+ 
+ 	if ($pun_config['o_censoring'] == '1')
++	{
+ 		$text = censor_words($text);
++	}
+ 
+-	// Convert applicable characters to HTML entities
+-	$text = pun_htmlspecialchars($text);
+-
+-	if ($pun_config['p_sig_bbcode'] == '1' && strpos($text, '[') !== false && strpos($text, ']') !== false)
+-		$text = do_bbcode($text, true);
+-
+-	if ($pun_config['o_smilies_sig'] == '1' && $pun_user['show_smilies'] == '1')
+-		$text = do_smilies($text);
+-
++	if ($textile === null)
++	{
++		$textile = new Netcarver\Textile\Parser();
++	}
+ 
+-	// Deal with newlines, tabs and multiple spaces
+-	$pattern = array("\n", "\t", '  ', '  ');
+-	$replace = array('<br />', '&#160; &#160; ', '&#160; ', ' &#160;');
+-	$text = str_replace($pattern, $replace, $text);
++	if (defined('PUN_NEW_MEMBER') && $cur_post['group_id'] == PUN_NEW_MEMBER)
++	{
++		return $textile->textileRestricted($text, false, true);
++	}
+ 
+-	return clean_paragraphs($text);
++	return $textile->textileRestricted($text, false, false);
+ }

-	}
-	else
-		return $text;
+	return wordwrap($text, min(72, (int) $wrap_length));
 }
 
 
diff --git a/include/parser.php b/include/parser.php
index fde6e8b..a7e7f89 100644
--- a/include/parser.php
+++ b/include/parser.php
@@ -64,6 +64,7 @@ $smilies = array(

diff --git a/include/email.php b/include/email.php
index 88c62a8..e4dc5d1 100644
--- a/include/email.php
+++ b/include/email.php
@@ -60,149 +60,7 @@ function encode_mail_text($str)
