diff --git a/PseudoCode.js b/PseudoCode.js
index c931898c2c120b327e425f86121e76897a907c70..007ceeb8db097724a64284f75c5be9acc992f8c9 100644
--- a/PseudoCode.js
+++ b/PseudoCode.js
@@ -516,8 +516,7 @@ Parser.prototype._parseLoop = function() {
 var CONDITION_COMMANDS = ['ENSURE', 'REQUIRE'];
 var STATEMENT_COMMANDS = ['STATE', 'PRINT', 'RETURN'];
 Parser.prototype._parseCommand = function(acceptCommands) {
-    if (!this._lexer.accept('func', acceptCommands))
-        return null;
+    if (!this._lexer.accept('func', acceptCommands)) return null;
 
     var cmdName = this._lexer.get().text;
     var cmdNode = new ParseNode('command', cmdName);
@@ -526,7 +525,7 @@ Parser.prototype._parseCommand = function(acceptCommands) {
 };
 
 Parser.prototype._parseComment = function() {
-    if (this._lexer.get().text !== 'COMMENT') return null;
+    if (!this._lexer.accept('func', 'COMMENT')) return null;
 
     var commentNode = new ParseNode('comment');
 
@@ -647,7 +646,7 @@ function RendererOptions(options) {
     options = options || {};
     this.indentSize = options.indentSize ?
                         this._parseEmVal(options.indentSize) : 1.2;
-    this.commentSymbol = options.commentSymbol || '//';
+    this.commentSymbol = options.commentSymbol || ' // ';
     this.lineNumberPunc = options.lineNumberPunc || ':';
     this.lineNumber = options.lineNumber != null ? options.lineNumber : false;
     this.noEnd = options.noEnd != null ? options.noEnd : false;
@@ -1177,7 +1176,7 @@ Renderer.prototype._buildTree = function(node) {
         var textNode = node.children[0];
         var blockNode = node.children[1];
         this._newLine();
-        this._typeKeyword(funcType);
+        this._typeKeyword(funcType + ' ');
         this._typeFuncName(funcName);
         this._typeText('(');
         this._buildTree(textNode);
@@ -1199,10 +1198,10 @@ Renderer.prototype._buildTree = function(node) {
         //      <span class="ps-keyword">then</span>
         // </p>
         this._newLine();
-        this._typeKeyword('if');
+        this._typeKeyword('if ');
         var cond = node.children[0];
         this._buildTree(cond);
-        this._typeKeyword('then');
+        this._typeKeyword(' then');
         // <block>
         var ifBlock = node.children[1];
         this._buildTree(ifBlock);
@@ -1218,10 +1217,10 @@ Renderer.prototype._buildTree = function(node) {
             //      <span class="ps-keyword">then</span>
             // </p>
             this._newLine();
-            this._typeKeyword('else if');
+            this._typeKeyword('else if ');
             var elifCond = node.children[2 + 2 * ei];
             this._buildTree(elifCond);
-            this._typeKeyword('then');
+            this._typeKeyword(' then');
 
             // <block>
             var elifBlock = node.children[2 + 2 * ei + 1];
@@ -1265,10 +1264,10 @@ Renderer.prototype._buildTree = function(node) {
             'FORALL': 'for all',
             'WHILE': 'while'
         };
-        this._typeKeyword(displayLoopName[loopType]);
+        this._typeKeyword(displayLoopName[loopType] + ' ');
         var cond = node.children[0];
         this._buildTree(cond);
-        this._typeKeyword('do');
+        this._typeKeyword(' do');
 
         // <block>
         var block = node.children[1];
@@ -1304,19 +1303,23 @@ Renderer.prototype._buildTree = function(node) {
         break;
     case 'caption':
         this._newLine();
-        this._typeKeyword('Algorithm ' + Renderer._captionCount);
+        this._typeKeyword('Algorithm ' + Renderer._captionCount + ' ');
         var textNode = node.children[0];
         this._buildTree(textNode);
         break;
-    // 'comment':
-    //     break;
+    case 'comment':
+        var textNode = node.children[0];
+        this._html.beginSpan('ps-comment');
+        this._html.putText(this._options.commentSymbol);
+        this._buildTree(textNode);
+        this._html.endSpan();
+        break;
     case 'call':
         // \CALL{funcName}{funcArgs}
         // ==>
         // funcName(funcArgs)
         var funcName = node.value;
         var argsNode = node.children[0];
-
         this._typeFuncName(funcName);
         this._typeText('(');
         this._buildTree(argsNode);
diff --git a/css/PseudoCode.css b/css/PseudoCode.css
index f9db55717de1f012fb291e5673d30d12c7397c71..92434f123eabf7bc25ba31d64e5d41fd0b36265c 100644
--- a/css/PseudoCode.css
+++ b/css/PseudoCode.css
@@ -34,10 +34,13 @@
     font-variant: normal;
     font-style: normal;
     text-transform: none;
-    margin: 0 0.25em;
 }
-.ps-root .ps-keyword:first-child{
-    margin: 0 0.25em 0 0;
+.ps-root .ps-comment {
+    font-family: KaTeX_Main;
+    font-weight: normal;
+    font-variant: normal;
+    font-style: normal;
+    text-transform: none;
 }
 /* line number support */
 .ps-root .ps-linenum {
diff --git a/test-suite.html b/test-suite.html
index 62d40b89f045684ef0de8d78858c1b55ffff6dd1..d29f35673fa0e3f98298dcf1f8c84379af03e7d4 100644
--- a/test-suite.html
+++ b/test-suite.html
@@ -86,6 +86,7 @@
         \end{algorithmic}
         \end{algorithm}
     </pre>
+    <!-- Chapter 7, Introduction to Algorithms (3rd edition)-->
     <pre id="test-examples" style="display:none">
         \begin{algorithm}
         \caption{Quicksort}
@@ -93,6 +94,7 @@
         \PROCEDURE{Quicksort}{$A, p, r$}
             \IF{$p < r$} 
                 \STATE $q = $ \CALL{Partition}{$A, p, r$}
+                \COMMENT{this is comment}
                 \STATE \CALL{Quicksort}{$A, p, q - 1$}
                 \STATE \CALL{Quicksort}{$A, q + 1, r$}
             \ENDIF