Greatly simplify the logic of finding delimiters

also changed the format of SetCommentVars
also changed indentation of everything