Index: doc/papers/concurrency/Makefile
===================================================================
--- doc/papers/concurrency/Makefile	(revision 41624f920cc089ca5cfd4d561c8971bc2c474125)
+++ doc/papers/concurrency/Makefile	(revision aac71977640c99334881f777535dfd1070e0a264)
@@ -4,5 +4,5 @@
 Figures = figures
 Macros = AMA/AMA-stix/ama
-TeXLIB = .:style:annex:../../LaTeXmacros:${Macros}:${Build}:../../bibliography:
+TeXLIB = .:annex:../../LaTeXmacros:${Macros}:${Build}:../../bibliography:
 LaTeX  = TEXINPUTS=${TeXLIB} && export TEXINPUTS && latex -halt-on-error -output-directory=${Build}
 BibTeX = BIBINPUTS=${TeXLIB} && export BIBINPUTS && bibtex
Index: doc/papers/concurrency/Paper.tex
===================================================================
--- doc/papers/concurrency/Paper.tex	(revision 41624f920cc089ca5cfd4d561c8971bc2c474125)
+++ doc/papers/concurrency/Paper.tex	(revision aac71977640c99334881f777535dfd1070e0a264)
@@ -1,10 +1,2 @@
-% inline code ©...© (copyright symbol) emacs: C-q M-)
-% red highlighting ®...® (registered trademark symbol) emacs: C-q M-.
-% blue highlighting ß...ß (sharp s symbol) emacs: C-q M-_
-% green highlighting ¢...¢ (cent symbol) emacs: C-q M-"
-% LaTex escape §...§ (section symbol) emacs: C-q M-'
-% keyword escape ¶...¶ (pilcrow symbol) emacs: C-q M-^
-% math escape $...$ (dollar symbol)
-
 \documentclass[AMA,STIX1COL]{WileyNJD-v2}
 
@@ -20,9 +12,4 @@
 
 % Latex packages used in the document.
-
-\usepackage[T1]{fontenc}					% allow Latin1 (extended ASCII) characters
-\usepackage{textcomp}
-\usepackage[latin1]{inputenc}
-
 \usepackage{epic,eepic}
 \usepackage{xspace}
@@ -34,5 +21,5 @@
 \usepackage{siunitx}
 \sisetup{ binary-units=true }
-\input{style}								% bespoke macros used in the document
+%\input{style}								% bespoke macros used in the document
 
 \hypersetup{breaklinks=true}
@@ -51,5 +38,16 @@
 % Names used in the document.
 
-\newcommand{\CS}{C\raisebox{-0.9ex}{\large$^\sharp$}\xspace}
+\newcommand{\CFAIcon}{\textsf{C}\raisebox{\depth}{\rotatebox{180}{\textsf{A}}}\xspace} % Cforall symbolic name
+\newcommand{\CFA}{\protect\CFAIcon} 		% safe for section/caption
+\newcommand{\CFL}{\textrm{Cforall}\xspace} 	% Cforall symbolic name
+\newcommand{\Celeven}{\textrm{C11}\xspace} 	% C11 symbolic name
+\newcommand{\CC}{\textrm{C}\kern-.1em\hbox{+\kern-.25em+}\xspace} % C++ symbolic name
+\newcommand{\CCeleven}{\textrm{C}\kern-.1em\hbox{+\kern-.25em+}11\xspace} % C++11 symbolic name
+\newcommand{\CCfourteen}{\textrm{C}\kern-.1em\hbox{+\kern-.25em+}14\xspace} % C++14 symbolic name
+\newcommand{\CCseventeen}{\textrm{C}\kern-.1em\hbox{+\kern-.25em+}17\xspace} % C++17 symbolic name
+\newcommand{\CCtwenty}{\textrm{C}\kern-.1em\hbox{+\kern-.25em+}20\xspace} % C++20 symbolic name
+\newcommand{\Csharp}{C\raisebox{-0.7ex}{\Large$^\sharp$}\xspace} % C# symbolic name
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 \newcommand{\Textbf}[2][red]{{\color{#1}{\textbf{#2}}}}
@@ -62,8 +60,149 @@
 \newcommand{\TODO}{{\Textbf{TODO}}}
 
-
-\newsavebox{\LstBox}
-
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% Default underscore is too low and wide. Cannot use lstlisting "literate" as replacing underscore
+% removes it as a variable-name character so keywords in variables are highlighted. MUST APPEAR
+% AFTER HYPERREF.
+%\DeclareTextCommandDefault{\textunderscore}{\leavevmode\makebox[1.2ex][c]{\rule{1ex}{0.1ex}}}
+\renewcommand{\textunderscore}{\leavevmode\makebox[1.2ex][c]{\rule{1ex}{0.075ex}}}
+
+\makeatletter
+% parindent is relative, i.e., toggled on/off in environments like itemize, so store the value for
+% use rather than use \parident directly.
+\newlength{\parindentlnth}
+\setlength{\parindentlnth}{\parindent}
+
+\newcommand{\LstBasicStyle}[1]{{\lst@basicstyle{\lst@basicstyle{#1}}}}
+\newcommand{\LstKeywordStyle}[1]{{\lst@basicstyle{\lst@keywordstyle{#1}}}}
+\newcommand{\LstCommentStyle}[1]{{\lst@basicstyle{\lst@commentstyle{#1}}}}
+
+\newlength{\gcolumnposn}					% temporary hack because lstlisting does not handle tabs correctly
+\newlength{\columnposn}
+\setlength{\gcolumnposn}{3.5in}
+\setlength{\columnposn}{\gcolumnposn}
+\newcommand{\C}[2][\@empty]{\ifx#1\@empty\else\global\setlength{\columnposn}{#1}\global\columnposn=\columnposn\fi\hfill\makebox[\textwidth-\columnposn][l]{\lst@basicstyle{\LstCommentStyle{#2}}}}
+\newcommand{\CRT}{\global\columnposn=\gcolumnposn}
+
+% Denote newterms in particular font and index them without particular font and in lowercase, e.g., \newterm{abc}.
+% The option parameter provides an index term different from the new term, e.g., \newterm[\texttt{abc}]{abc}
+% The star version does not lowercase the index information, e.g., \newterm*{IBM}.
+\newcommand{\newtermFontInline}{\emph}
+\newcommand{\newterm}{\@ifstar\@snewterm\@newterm}
+\newcommand{\@newterm}[2][\@empty]{\lowercase{\def\temp{#2}}{\newtermFontInline{#2}}\ifx#1\@empty\index{\temp}\else\index{#1@{\protect#2}}\fi}
+\newcommand{\@snewterm}[2][\@empty]{{\newtermFontInline{#2}}\ifx#1\@empty\index{#2}\else\index{#1@{\protect#2}}\fi}
+
+% Latin abbreviation
+\newcommand{\abbrevFont}{\textit}			% set empty for no italics
+\newcommand{\EG}{\abbrevFont{e}.\abbrevFont{g}.}
+\newcommand*{\eg}{%
+	\@ifnextchar{,}{\EG}%
+		{\@ifnextchar{:}{\EG}%
+			{\EG,\xspace}}%
+}%
+\newcommand{\IE}{\abbrevFont{i}.\abbrevFont{e}.}
+\newcommand*{\ie}{%
+	\@ifnextchar{,}{\IE}%
+		{\@ifnextchar{:}{\IE}%
+			{\IE,\xspace}}%
+}%
+\newcommand{\ETC}{\abbrevFont{etc}}
+\newcommand*{\etc}{%
+	\@ifnextchar{.}{\ETC}%
+        {\ETC.\xspace}%
+}%
+\newcommand{\ETAL}{\abbrevFont{et}~\abbrevFont{al}}
+\renewcommand*{\etal}{%
+	\@ifnextchar{.}{\protect\ETAL}%
+		{\protect\ETAL.\xspace}%
+}%
+\newcommand{\VIZ}{\abbrevFont{viz}}
+\newcommand*{\viz}{%
+	\@ifnextchar{.}{\VIZ}%
+		{\VIZ.\xspace}%
+}%
+\makeatother
+
+\newenvironment{cquote}{%
+	\list{}{\lstset{resetmargins=true,aboveskip=0pt,belowskip=0pt}\topsep=3pt\parsep=0pt\leftmargin=\parindentlnth\rightmargin\leftmargin}%
+	\item\relax
+}{%
+	\endlist
+}% cquote
+
+% CFA programming language, based on ANSI C (with some gcc additions)
+\lstdefinelanguage{CFA}[ANSI]{C}{
+	morekeywords={
+		_Alignas, _Alignof, __alignof, __alignof__, asm, __asm, __asm__, _At, __attribute,
+		__attribute__, auto, _Bool, catch, catchResume, choose, _Complex, __complex, __complex__,
+		__const, __const__, disable, dtype, enable, exception, __extension__, fallthrough, fallthru,
+		finally, forall, ftype, _Generic, _Imaginary, inline, __label__, lvalue, _Noreturn, one_t,
+		otype, restrict, _Static_assert, throw, throwResume, trait, try, ttype, typeof, __typeof,
+		__typeof__, virtual, with, zero_t},
+	morekeywords=[2]{
+		_Atomic, coroutine, is_coroutine, is_monitor, is_thread, monitor, mutex, nomutex, or,
+		resume, suspend, thread, _Thread_local, waitfor, when, yield},
+	moredirectives={defined,include_next}%
+}
+
+\lstset{
+language=CFA,
+columns=fullflexible,
+basicstyle=\linespread{0.9}\sf,							% reduce line spacing and use sanserif font
+stringstyle=\tt,										% use typewriter font
+tabsize=5,												% N space tabbing
+xleftmargin=\parindentlnth,								% indent code to paragraph indentation
+%mathescape=true,										% LaTeX math escape in CFA code $...$
+escapechar=\$,											% LaTeX escape in CFA code
+keepspaces=true,										%
+showstringspaces=false,									% do not show spaces with cup
+showlines=true,											% show blank lines at end of code
+aboveskip=4pt,											% spacing above/below code block
+belowskip=3pt,
+% replace/adjust listing characters that look bad in sanserif
+literate={-}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.8ex}{0.1ex}}}}1 {^}{\raisebox{0.6ex}{$\scriptstyle\land\,$}}1
+	{~}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}}1 % {`}{\ttfamily\upshape\hspace*{-0.1ex}`}1
+	{<-}{$\leftarrow$}2 {=>}{$\Rightarrow$}2 {->}{\makebox[1ex][c]{\raisebox{0.5ex}{\rule{0.8ex}{0.075ex}}}\kern-0.2ex{\textgreater}}2,
+moredelim=**[is][\color{red}]{`}{`},
+}% lstset
+
+% uC++ programming language, based on ANSI C++
+\lstdefinelanguage{uC++}[ANSI]{C++}{
+	morekeywords={
+		_Accept, _AcceptReturn, _AcceptWait, _Actor, _At, _CatchResume, _Cormonitor, _Coroutine, _Disable,
+		_Else, _Enable, _Event, _Finally, _Monitor, _Mutex, _Nomutex, _PeriodicTask, _RealTimeTask,
+		_Resume, _Select, _SporadicTask, _Task, _Timeout, _When, _With, _Throw},
+}
+\lstdefinelanguage{Golang}{
+	morekeywords=[1]{package,import,func,type,struct,return,defer,panic,recover,select,var,const,iota,},
+	morekeywords=[2]{string,uint,uint8,uint16,uint32,uint64,int,int8,int16,int32,int64,
+		bool,float32,float64,complex64,complex128,byte,rune,uintptr, error,interface},
+	morekeywords=[3]{map,slice,make,new,nil,len,cap,copy,close,true,false,delete,append,real,imag,complex,chan,},
+	morekeywords=[4]{for,break,continue,range,goto,switch,case,fallthrough,if,else,default,},
+	morekeywords=[5]{Println,Printf,Error,},
+	sensitive=true,
+	morecomment=[l]{//},
+	morecomment=[s]{/*}{*/},
+	morestring=[b]',
+	morestring=[b]",
+	morestring=[s]{`}{`},
+}
+
+\lstnewenvironment{cfa}[1][]
+{\lstset{#1}}
+{}
+\lstnewenvironment{C++}[1][]                            % use C++ style
+{\lstset{language=C++,moredelim=**[is][\protect\color{red}]{`}{`},#1}\lstset{#1}}
+{}
+\lstnewenvironment{uC++}[1][]
+{\lstset{#1}}
+{}
+\lstnewenvironment{Go}[1][]
+{\lstset{#1}}
+{}
+
+% inline code @...@
+\lstMakeShortInline@%
+
 
 \title{\texorpdfstring{Concurrency in \protect\CFA}{Concurrency in Cforall}}
@@ -81,5 +220,5 @@
 \abstract[Summary]{
 \CFA is a modern, polymorphic, \emph{non-object-oriented} extension of the C programming language.
-This paper discusses the design of the concurrency and parallelism features in \CFA, and the concurrent runtime-system that supports them.
+This paper discusses the design of the concurrency and parallelism features in \CFA, and the concurrent runtime-system.
 These features are created from scratch as ISO C lacks concurrency, relying largely on pthreads.
 Coroutines and lightweight (user) threads are introduced into the language.
@@ -87,5 +226,5 @@
 A unique contribution is allowing multiple monitors to be safely acquired simultaneously.
 All features respect the expectations of C programmers, while being fully integrate with the \CFA polymorphic type-system and other language features.
-Finally, experimental results are presented to validate several of the new features with other concurrent programming-languages.
+Finally, experimental results are presented to compare the performance of the new features with similar mechanisms in other concurrent programming-languages.
 }%
 
@@ -104,24 +243,25 @@
 % ======================================================================
 
-This paper provides a minimal concurrency \textbf{api} that is simple, efficient and can be reused to build higher-level features.
-The simplest possible concurrency system is a thread and a lock but this low-level approach is hard to master.
-An easier approach for users is to support higher-level constructs as the basis of concurrency.
-Indeed, for highly productive concurrent programming, high-level approaches are much more popular~\cite{HPP:Study}.
-Examples are task based, message passing and implicit threading.
-The high-level approach and its minimal \textbf{api} are tested in a dialect of C, called \CFA.
-Furthermore, the proposed \textbf{api} doubles as an early definition of the \CFA language and library.
-This paper also provides an implementation of the concurrency library for \CFA as well as all the required language features added to the source-to-source translator.
-
-There are actually two problems that need to be solved in the design of concurrency for a programming language: which concurrency and which parallelism tools are available to the programmer.
+This paper provides a minimal concurrency \newterm{API} that is simple, efficient and can be used to build other concurrency features.
+While the simplest concurrency system is a thread and a lock, this low-level approach is hard to master.
+An easier approach for programmers is to support higher-level constructs as the basis of concurrency.
+Indeed, for highly productive concurrent programming, high-level approaches are much more popular~\cite{Hochstein05}.
+Examples of high-level approaches are task based~\cite{TBB}, message passing~\cite{Erlang,MPI}, and implicit threading~\cite{OpenMP}.
+
+The terminology used in this paper is as follows.
+A \newterm{thread} is a fundamental unit of execution that runs a sequence of code and requires a stack to maintain state.
+Multiple simultaneous threads gives rise to \newterm{concurrency}, which requires locking to ensure safe access to shared data.
+% Correspondingly, concurrency is defined as the concepts and challenges that occur when multiple independent (sharing memory, timing dependencies, etc.) concurrent threads are introduced.
+\newterm{Locking}, and by extension locks, are defined as a mechanism to prevent progress of threads to provide safety.
+\newterm{Parallelism} is running multiple threads simultaneously.
+Parallelism implies \emph{actual} simultaneous execution, where concurrency only requires \emph{apparent} simultaneous execution.
+As such, parallelism is only observable in differences in performance, which is observed through differences in timing.
+
+Hence, there are two problems to be solved in the design of concurrency for a programming language: concurrency and parallelism.
 While these two concepts are often combined, they are in fact distinct, requiring different tools~\cite{Buhr05a}.
-Concurrency tools need to handle mutual exclusion and synchronization, while parallelism tools are about performance, cost and resource utilization.
-
-In the context of this paper, a \textbf{thread} is a fundamental unit of execution that runs a sequence of code, generally on a program stack.
-Having multiple simultaneous threads gives rise to concurrency and generally requires some kind of locking mechanism to ensure proper execution.
-Correspondingly, \textbf{concurrency} is defined as the concepts and challenges that occur when multiple independent (sharing memory, timing dependencies, etc.) concurrent threads are introduced.
-Accordingly, \textbf{locking} (and by extension locks) are defined as a mechanism that prevents the progress of certain threads in order to avoid problems due to concurrency.
-Finally, in this paper \textbf{parallelism} is distinct from concurrency and is defined as running multiple threads simultaneously.
-More precisely, parallelism implies \emph{actual} simultaneous execution as opposed to concurrency which only requires \emph{apparent} simultaneous execution.
-As such, parallelism is only observable in the differences in performance or, more generally, differences in timing.
+Concurrency tools handle mutual exclusion and synchronization, while parallelism tools handle performance, cost and resource utilization.
+
+The proposed concurrency API is implemented in a dialect of C, called \CFA.
+The paper discusses how the language features are added to the \CFA translator with respect to parsing, semantic, and type checking, and the corresponding high-perforamnce runtime-library to implement the concurrency features.
 
 % ======================================================================
@@ -139,24 +279,24 @@
 Interestingly, while \CFA is not an object-oriented language, lacking the concept of a receiver (e.g., {\tt this}), it does have some notion of objects\footnote{C defines the term objects as : ``region of data storage in the execution environment, the contents of which can represent
 values''~\cite[3.15]{C11}}, most importantly construction and destruction of objects.
-Most of the following code examples can be found on the \CFA website~\cite{www-cfa}.
-
-% ======================================================================
+Most of the following code examples can be found on the \CFA website~\cite{Cforall}.
+
+
 \subsection{References}
 
 Like \CC, \CFA introduces rebind-able references providing multiple dereferencing as an alternative to pointers.
 In regards to concurrency, the semantic difference between pointers and references are not particularly relevant, but since this document uses mostly references, here is a quick overview of the semantics:
-\begin{cfacode}
+\begin{cfa}
 int x, *p1 = &x, **p2 = &p1, ***p3 = &p2,
 	&r1 = x,    &&r2 = r1,   &&&r3 = r2;
-***p3 = 3;							//change x
-r3    = 3;							//change x, ***r3
-**p3  = ...;						//change p1
-*p3   = ...;						//change p2
-int y, z, & ar[3] = {x, y, z};		//initialize array of references
-typeof( ar[1]) p;					//is int, referenced object type
-typeof(&ar[1]) q;					//is int &, reference type
-sizeof( ar[1]) == sizeof(int);		//is true, referenced object size
-sizeof(&ar[1]) == sizeof(int *);	//is true, reference size
-\end{cfacode}
+***p3 = 3;							$\C{// change x}$
+r3    = 3;							$\C{// change x, ***r3}$
+**p3  = ...;						$\C{// change p1}$
+*p3   = ...;						$\C{// change p2}$
+int y, z, & ar[3] = {x, y, z};		$\C{// initialize array of references}$
+typeof( ar[1]) p;					$\C{// is int, referenced object type}$
+typeof(&ar[1]) q;					$\C{// is int \&, reference type}$
+sizeof( ar[1]) == sizeof(int);		$\C{// is true, referenced object size}$
+sizeof(&ar[1]) == sizeof(int *);	$\C{// is true, reference size}$
+\end{cfa}
 The important take away from this code example is that a reference offers a handle to an object, much like a pointer, but which is automatically dereferenced for convenience.
 
@@ -167,22 +307,22 @@
 As well, \CFA uses the return type as part of the selection criteria, as in Ada~\cite{Ada}.
 For routines with multiple parameters and returns, the selection is complex.
-\begin{cfacode}
-//selection based on type and number of parameters
-void f(void);			//(1)
-void f(char);			//(2)
-void f(int, double);	//(3)
-f();					//select (1)
-f('a');					//select (2)
-f(3, 5.2);				//select (3)
-
-//selection based on  type and number of returns
-char   f(int);			//(1)
-double f(int);			//(2)
-char   c = f(3);		//select (1)
-double d = f(4);		//select (2)
-\end{cfacode}
+\begin{cfa}
+// selection based on type and number of parameters
+void f(void);			$\C{// (1)}$
+void f(char);			$\C{// (2)}$
+void f(int, double);	$\C{// (3)}$
+f();					$\C{// select (1)}$
+f('a');					$\C{// select (2)}$
+f(3, 5.2);				$\C{// select (3)}$
+
+// selection based on  type and number of returns
+char   f(int);			$\C{// (1)}$
+double f(int);			$\C{// (2)}$
+char   c = f(3);		$\C{// select (1)}$
+double d = f(4);		$\C{// select (2)}$
+\end{cfa}
 This feature is particularly important for concurrency since the runtime system relies on creating different types to represent concurrency objects.
 Therefore, overloading is necessary to prevent the need for long prefixes and other naming conventions that prevent name clashes.
-As seen in section \ref{basics}, routine \code{main} is an example that benefits from overloading.
+As seen in section \ref{basics}, routine @main@ is an example that benefits from overloading.
 
 % ======================================================================
@@ -190,19 +330,19 @@
 Overloading also extends to operators.
 The syntax for denoting operator-overloading is to name a routine with the symbol of the operator and question marks where the arguments of the operation appear, e.g.:
-\begin{cfacode}
-int ++? (int op);              		//unary prefix increment
-int ?++ (int op);              		//unary postfix increment
-int ?+? (int op1, int op2);    		//binary plus
-int ?<=?(int op1, int op2);   		//binary less than
-int ?=? (int & op1, int op2);  		//binary assignment
-int ?+=?(int & op1, int op2); 		//binary plus-assignment
+\begin{cfa}
+int ++? (int op);              		$\C{// unary prefix increment}$
+int ?++ (int op);              		$\C{// unary postfix increment}$
+int ?+? (int op1, int op2);    		$\C{// binary plus}$
+int ?<=?(int op1, int op2);   		$\C{// binary less than}$
+int ?=? (int & op1, int op2);  		$\C{// binary assignment}$
+int ?+=?(int & op1, int op2); 		$\C{// binary plus-assignment}$
 
 struct S {int i, j;};
-S ?+?(S op1, S op2) {				//add two structures
+S ?+?(S op1, S op2) {				$\C{// add two structures}$
 	return (S){op1.i + op2.i, op1.j + op2.j};
 }
 S s1 = {1, 2}, s2 = {2, 3}, s3;
-s3 = s1 + s2;						//compute sum: s3 == {2, 5}
-\end{cfacode}
+s3 = s1 + s2;						$\C{// compute sum: s3 == {2, 5}}$
+\end{cfa}
 While concurrency does not use operator overloading directly, this feature is more important as an introduction for the syntax of constructors.
 
@@ -211,37 +351,37 @@
 Object lifetime is often a challenge in concurrency. \CFA uses the approach of giving concurrent meaning to object lifetime as a means of synchronization and/or mutual exclusion.
 Since \CFA relies heavily on the lifetime of objects, constructors and destructors is a core feature required for concurrency and parallelism. \CFA uses the following syntax for constructors and destructors:
-\begin{cfacode}
+\begin{cfa}
 struct S {
 	size_t size;
 	int * ia;
 };
-void ?{}(S & s, int asize) {	//constructor operator
-	s.size = asize;				//initialize fields
+void ?{}(S & s, int asize) {	$\C{// constructor operator}$
+	s.size = asize;				$\C{// initialize fields}$
 	s.ia = calloc(size, sizeof(S));
 }
-void ^?{}(S & s) {				//destructor operator
-	free(ia);					//de-initialization fields
+void ^?{}(S & s) {				$\C{// destructor operator}$
+	free(ia);					$\C{// de-initialization fields}$
 }
 int main() {
-	S x = {10}, y = {100};		//implicit calls: ?{}(x, 10), ?{}(y, 100)
-	...							//use x and y
-	^x{};  ^y{};				//explicit calls to de-initialize
-	x{20};  y{200};				//explicit calls to reinitialize
-	...							//reuse x and y
-}								//implicit calls: ^?{}(y), ^?{}(x)
-\end{cfacode}
+	S x = {10}, y = {100};		$\C{// implicit calls: ?\{\}(x, 10), ?\{\}(y, 100)}$
+	...							$\C{// use x and y}$
+	^x{};  ^y{};				$\C{// explicit calls to de-initialize}$
+	x{20};  y{200};				$\C{// explicit calls to reinitialize}$
+	...							$\C{// reuse x and y}$
+}								$\C{// implicit calls: \^?\{\}(y), \^?\{\}(x)}$
+\end{cfa}
 The language guarantees that every object and all their fields are constructed.
 Like \CC, construction of an object is automatically done on allocation and destruction of the object is done on deallocation.
 Allocation and deallocation can occur on the stack or on the heap.
-\begin{cfacode}
+\begin{cfa}
 {
-	struct S s = {10};	//allocation, call constructor
+	struct S s = {10};	$\C{// allocation, call constructor}$
 	...
-}						//deallocation, call destructor
-struct S * s = new();	//allocation, call constructor
+}						$\C{// deallocation, call destructor}$
+struct S * s = new();	$\C{// allocation, call constructor}$
 ...
-delete(s);				//deallocation, call destructor
-\end{cfacode}
-Note that like \CC, \CFA introduces \code{new} and \code{delete}, which behave like \code{malloc} and \code{free} in addition to constructing and destructing objects, after calling \code{malloc} and before calling \code{free}, respectively.
+delete(s);				$\C{// deallocation, call destructor}$
+\end{cfa}
+Note that like \CC, \CFA introduces @new@ and @delete@, which behave like @malloc@ and @free@ in addition to constructing and destructing objects, after calling @malloc@ and before calling @free@, respectively.
 
 % ======================================================================
@@ -249,67 +389,67 @@
 \label{s:ParametricPolymorphism}
 Routines in \CFA can also be reused for multiple types.
-This capability is done using the \code{forall} clauses, which allow separately compiled routines to support generic usage over multiple types.
+This capability is done using the @forall@ clauses, which allow separately compiled routines to support generic usage over multiple types.
 For example, the following sum function works for any type that supports construction from 0 and addition:
-\begin{cfacode}
-//constraint type, 0 and +
+\begin{cfa}
+// constraint type, 0 and +
 forall(otype T | { void ?{}(T *, zero_t); T ?+?(T, T); })
 T sum(T a[ ], size_t size) {
-	T total = 0;				//construct T from 0
+	T total = 0;				$\C{// construct T from 0}$
 	for(size_t i = 0; i < size; i++)
-		total = total + a[i];	//select appropriate +
+		total = total + a[i];	$\C{// select appropriate +}$
 	return total;
 }
 
 S sa[5];
-int i = sum(sa, 5);				//use S's 0 construction and +
-\end{cfacode}
+int i = sum(sa, 5);				$\C{// use S's 0 construction and +}$
+\end{cfa}
 
 Since writing constraints on types can become cumbersome for more constrained functions, \CFA also has the concept of traits.
 Traits are named collection of constraints that can be used both instead and in addition to regular constraints:
-\begin{cfacode}
+\begin{cfa}
 trait summable( otype T ) {
-	void ?{}(T *, zero_t);		//constructor from 0 literal
-	T ?+?(T, T);				//assortment of additions
+	void ?{}(T *, zero_t);		$\C{// constructor from 0 literal}$
+	T ?+?(T, T);				$\C{// assortment of additions}$
 	T ?+=?(T *, T);
 	T ++?(T *);
 	T ?++(T *);
 };
-forall( otype T | summable(T) )	//use trait
+forall( otype T | summable(T) )	$\C{// use trait}$
 T sum(T a[], size_t size);
-\end{cfacode}
-
-Note that the type use for assertions can be either an \code{otype} or a \code{dtype}.
-Types declared as \code{otype} refer to ``complete'' objects, i.e., objects with a size, a default constructor, a copy constructor, a destructor and an assignment operator.
-Using \code{dtype,} on the other hand, has none of these assumptions but is extremely restrictive, it only guarantees the object is addressable.
+\end{cfa}
+
+Note that the type use for assertions can be either an @otype@ or a @dtype@.
+Types declared as @otype@ refer to ``complete'' objects, i.e., objects with a size, a default constructor, a copy constructor, a destructor and an assignment operator.
+Using @dtype@, on the other hand, has none of these assumptions but is extremely restrictive, it only guarantees the object is addressable.
 
 % ======================================================================
 \subsection{with Clause/Statement}
 Since \CFA lacks the concept of a receiver, certain functions end up needing to repeat variable names often.
-To remove this inconvenience, \CFA provides the \code{with} statement, which opens an aggregate scope making its fields directly accessible (like Pascal).
-\begin{cfacode}
+To remove this inconvenience, \CFA provides the @with@ statement, which opens an aggregate scope making its fields directly accessible (like Pascal).
+\begin{cfa}
 struct S { int i, j; };
-int mem(S & this) with (this)		//with clause
-	i = 1;							//this->i
-	j = 2;							//this->j
+int mem(S & this) with (this)		$\C{// with clause}$
+	i = 1;							$\C{// this->i}$
+	j = 2;							$\C{// this->j}$
 }
 int foo() {
 	struct S1 { ... } s1;
 	struct S2 { ... } s2;
-	with (s1) 						//with statement
+	with (s1) 						$\C{// with statement}$
 	{
-		//access fields of s1 without qualification
-		with (s2)					//nesting
+		// access fields of s1 without qualification
+		with (s2)					$\C{// nesting}$
 		{
-			//access fields of s1 and s2 without qualification
+			// access fields of s1 and s2 without qualification
 		}
 	}
-	with (s1, s2) 					//scopes open in parallel
+	with (s1, s2) 					$\C{// scopes open in parallel}$
 	{
-		//access fields of s1 and s2 without qualification
-	}
-}
-\end{cfacode}
-
-For more information on \CFA see \cite{cforall-ug,rob-thesis,www-cfa}.
+		// access fields of s1 and s2 without qualification
+	}
+}
+\end{cfa}
+
+For more information on \CFA see \cite{cforall-ug,Schluntz17,www-cfa}.
 
 % ======================================================================
@@ -339,5 +479,7 @@
 Optimal performance in concurrent applications is often obtained by having as much non-determinism as correctness allows.
 
+
 \section{\protect\CFA's Thread Building Blocks}
+
 One of the important features that are missing in C is threading\footnote{While the C11 standard defines a ``threads.h'' header, it is minimal and defined as optional.
 As such, library support for threading is far from widespread.
@@ -347,122 +489,86 @@
 And being a system-level language means programmers expect to choose precisely which features they need and which cost they are willing to pay.
 
+
 \section{Coroutines: A Stepping Stone}\label{coroutine}
+
 While the main focus of this proposal is concurrency and parallelism, it is important to address coroutines, which are actually a significant building block of a concurrency system. \textbf{Coroutine}s are generalized routines which have predefined points where execution is suspended and can be resumed at a later time.
 Therefore, they need to deal with context switches and other context-management operations.
 This proposal includes coroutines both as an intermediate step for the implementation of threads, and a first-class feature of \CFA.
 Furthermore, many design challenges of threads are at least partially present in designing coroutines, which makes the design effort that much more relevant.
-The core \textbf{api} of coroutines revolves around two features: independent call-stacks and \code{suspend}/\code{resume}.
-
-\begin{table}
+The core \textbf{api} of coroutines revolves around two features: independent call-stacks and @suspend@/@resume@.
+
+\begin{figure}
 \begin{center}
-\begin{tabular}{c @{\hskip 0.025in}|@{\hskip 0.025in} c @{\hskip 0.025in}|@{\hskip 0.025in} c}
-\begin{ccode}[tabsize=2]
-//Using callbacks
+\begin{tabular}{c|c|c}
+\begin{cfa}
+// Using callback
 void fibonacci_func(
 	int n,
-	void (*callback)(int)
+	void (* callback)( int )
 ) {
-	int first = 0;
-	int second = 1;
-	int next, i;
-	for(i = 0; i < n; i++)
-	{
-		if(i <= 1)
-			next = i;
-		else {
-			next = f1 + f2;
-			f1 = f2;
-			f2 = next;
-		}
-		callback(next);
-	}
-}
-
+	int fn, f1 = 0, f2 = 1;
+	for ( int i = 0; i < n; i++ ) {
+		callback( f1 );
+		fn = f1 + f2;
+		f1 = f2;  f2 = fn;
+	}
+}
 int main() {
-	void print_fib(int n) {
-		printf("%d\n", n);
-	}
-
-	fibonacci_func(
-		10, print_fib
-	);
-
-
-
-}
-\end{ccode}&\begin{ccode}[tabsize=2]
-//Using output array
+	void print_fib( int n ) {
+		printf( "%d\n", n );
+	}
+	fibonacci_func( 10, print_fib );
+}
+
+\end{cfa}
+&
+\begin{cfa}
+// Using output array
 void fibonacci_array(
 	int n,
-	int* array
+	int * array
 ) {
-	int f1 = 0; int f2 = 1;
-	int next, i;
-	for(i = 0; i < n; i++)
-	{
-		if(i <= 1)
-			next = i;
-		else {
-			next = f1 + f2;
-			f1 = f2;
-			f2 = next;
-		}
-		array[i] = next;
-	}
-}
-
-
+	int fn, f1 = 0, f2 = 1;
+	for ( int i = 0; i < n; i++ ) {
+		array[i] = f1;
+		fn = f1 + f2;
+		f1 = f2;  f2 = fn;
+	}
+}
 int main() {
 	int a[10];
-
-	fibonacci_func(
-		10, a
-	);
-
-	for(int i=0;i<10;i++){
-		printf("%d\n", a[i]);
-	}
-
-}
-\end{ccode}&\begin{ccode}[tabsize=2]
-//Using external state
+	fibonacci_array( 10, a );
+	for ( int i = 0; i < 10; i++ ) {
+		printf( "%d\n", a[i] );
+	}
+}
+\end{cfa}
+&
+\begin{cfa}
+// Using external state
 typedef struct {
 	int f1, f2;
 } Iterator_t;
-
 int fibonacci_state(
-	Iterator_t* it
+	Iterator_t * it
 ) {
-	int f;
-	f = it->f1 + it->f2;
-	it->f2 = it->f1;
-	it->f1 = max(f,1);
-	return f;
-}
-
-
-
-
-
-
-
+	int ret = it->f1;
+	int fn = it->f1 + it->f2;
+	it->f2 = it->f1; it->f1 = fn;
+	return ret;
+}
 int main() {
-	Iterator_t it={0,0};
-
-	for(int i=0;i<10;i++){
-		printf("%d\n",
-			fibonacci_state(
-				&it
-			);
-		);
-	}
-
-}
-\end{ccode}
+	Iterator_t it = { 0, 1 };
+	for ( int i = 0; i < 10; i++ ) {
+		printf( "%d\n",
+			fibonacci_state( &it ) );
+	}
+}
+\end{cfa}
 \end{tabular}
 \end{center}
-\caption{Different implementations of a Fibonacci sequence generator in C.}
+\caption{C Fibonacci Implementations}
 \label{lst:fibonacci-c}
-\end{table}
+\end{figure}
 
 A good example of a problem made easier with coroutines is generators, e.g., generating the Fibonacci sequence.
@@ -474,42 +580,28 @@
 Listing \ref{lst:fibonacci-cfa} is an example of a solution to the Fibonacci problem using \CFA coroutines, where the coroutine stack holds sufficient state for the next generation.
 This solution has the advantage of having very strong decoupling between how the sequence is generated and how it is used.
-Indeed, this version is as easy to use as the \code{fibonacci_state} solution, while the implementation is very similar to the \code{fibonacci_func} example.
+Indeed, this version is as easy to use as the @fibonacci_state@ solution, while the implementation is very similar to the @fibonacci_func@ example.
 
 \begin{figure}
-\begin{cfacode}[caption={Implementation of Fibonacci using coroutines},label={lst:fibonacci-cfa}]
-coroutine Fibonacci {
-	int fn; //used for communication
-};
-
-void ?{}(Fibonacci& this) { //constructor
-	this.fn = 0;
-}
-
-//main automatically called on first resume
-void main(Fibonacci& this) with (this) {
-	int fn1, fn2; 		//retained between resumes
-	fn  = 0;
-	fn1 = fn;
-	suspend(this); 		//return to last resume
-
-	fn  = 1;
-	fn2 = fn1;
-	fn1 = fn;
-	suspend(this); 		//return to last resume
-
+\begin{cfa}
+coroutine Fibonacci { int fn; };				$\C{// used for communication}$
+
+void ?{}( Fibonacci & fib ) with( fib ) { fn = 0; } $\C{// constructor}$
+
+void main( Fibonacci & fib ) with( fib ) {		$\C{// main called on first resume}$
+	int fn1, fn2; 								$\C{// retained between resumes}$
+	fn = 0;  fn1 = fn;							$\C{// 1st case}$
+	suspend();									$\C{// restart last resume}$
+	fn = 1;  fn2 = fn1;  fn1 = fn;				$\C{// 2nd case}$
+	suspend();									$\C{// restart last resume}$
 	for ( ;; ) {
-		fn  = fn1 + fn2;
-		fn2 = fn1;
-		fn1 = fn;
-		suspend(this); 	//return to last resume
-	}
-}
-
-int next(Fibonacci& this) {
-	resume(this); //transfer to last suspend
-	return this.fn;
-}
-
-void main() { //regular program main
+		fn = fn1 + fn2; fn2 = fn1;  fn1 = fn;	$\C{// general case}$
+		suspend();								$\C{// restart last resume}$
+	}
+}
+int next( Fibonacci & fib ) with( fib ) {
+	resume( fib );								$\C{// restart last suspend}$
+	return fn;
+}
+int main() {
 	Fibonacci f1, f2;
 	for ( int i = 1; i <= 10; i += 1 ) {
@@ -517,20 +609,22 @@
 	}
 }
-\end{cfacode}
+\end{cfa}
+\caption{Coroutine Fibonacci }
+\label{lst:fibonacci-cfa}
 \end{figure}
 
-Listing \ref{lst:fmt-line} shows the \code{Format} coroutine for restructuring text into groups of character blocks of fixed size.
+Listing \ref{lst:fmt-line} shows the @Format@ coroutine for restructuring text into groups of character blocks of fixed size.
 The example takes advantage of resuming coroutines in the constructor to simplify the code and highlights the idea that interesting control flow can occur in the constructor.
 
 \begin{figure}
-\begin{cfacode}[tabsize=3,caption={Formatting text into lines of 5 blocks of 4 characters.},label={lst:fmt-line}]
-//format characters into blocks of 4 and groups of 5 blocks per line
+\begin{cfa}[tabsize=3,caption={Formatting text into lines of 5 blocks of 4 characters.},label={lst:fmt-line}]
+// format characters into blocks of 4 and groups of 5 blocks per line
 coroutine Format {
-	char ch;									//used for communication
-	int g, b;								//global because used in destructor
+	char ch;									// used for communication
+	int g, b;								// global because used in destructor
 };
 
 void  ?{}(Format& fmt) {
-	resume( fmt );  						//prime (start) coroutine
+	resume( fmt );  						// prime (start) coroutine
 }
 
@@ -541,13 +635,13 @@
 
 void main(Format& fmt) with fmt {
-	for ( ;; ) {							//for as many characters
-		for(g = 0; g < 5; g++) {		//groups of 5 blocks
-			for(b = 0; b < 4; fb++) {	//blocks of 4 characters
+	for ( ;; ) {							// for as many characters
+		for(g = 0; g < 5; g++) {		// groups of 5 blocks
+			for(b = 0; b < 4; fb++) {	// blocks of 4 characters
 				suspend();
-				sout | ch;					//print character
+				sout | ch;					// print character
 			}
-			sout | "  ";					//print block separator
+			sout | "  ";					// print block separator
 		}
-		sout | endl;						//print group separator
+		sout | endl;						// print group separator
 	}
 }
@@ -561,11 +655,11 @@
 	Format fmt;
 	char ch;
-	Eof: for ( ;; ) {						//read until end of file
-		sin | ch;							//read one character
-		if(eof(sin)) break Eof;			//eof ?
-		prt(fmt, ch);						//push character for formatting
-	}
-}
-\end{cfacode}
+	Eof: for ( ;; ) {						// read until end of file
+		sin | ch;							// read one character
+		if(eof(sin)) break Eof;			// eof ?
+		prt(fmt, ch);						// push character for formatting
+	}
+}
+\end{cfa}
 \end{figure}
 
@@ -582,6 +676,6 @@
 For example, the following code, while looking benign, can run into undefined behaviour because of thunks:
 
-\begin{cfacode}
-//async: Runs function asynchronously on another thread
+\begin{cfa}
+// async: Runs function asynchronously on another thread
 forall(otype T)
 extern void async(void (*func)(T*), T* obj);
@@ -592,11 +686,11 @@
 void bar() {
 	int a;
-	async(noop, &a); //start thread running noop with argument a
-}
-\end{cfacode}
+	async(noop, &a); // start thread running noop with argument a
+}
+\end{cfa}
 
 The generated C code\footnote{Code trimmed down for brevity} creates a local thunk to hold type information:
 
-\begin{ccode}
+\begin{cfa}
 extern void async(/* omitted */, void (*func)(void*), void* obj);
 
@@ -612,6 +706,6 @@
 	async(/* omitted */, ((void (*)(void*))(&_thunk0)), (&a));
 }
-\end{ccode}
-The problem in this example is a storage management issue, the function pointer \code{_thunk0} is only valid until the end of the block, which limits the viable solutions because storing the function pointer for too long causes undefined behaviour; i.e., the stack-based thunk being destroyed before it can be used.
+\end{cfa}
+The problem in this example is a storage management issue, the function pointer @_thunk0@ is only valid until the end of the block, which limits the viable solutions because storing the function pointer for too long causes undefined behaviour; i.e., the stack-based thunk being destroyed before it can be used.
 This challenge is an extension of challenges that come with second-class routines.
 Indeed, GCC nested routines also have the limitation that nested routine cannot be passed outside of the declaration scope.
@@ -621,8 +715,8 @@
 One solution to this challenge is to use composition/containment, where coroutine fields are added to manage the coroutine.
 
-\begin{cfacode}
+\begin{cfa}
 struct Fibonacci {
-	int fn; //used for communication
-	coroutine c; //composition
+	int fn; // used for communication
+	coroutine c; // composition
 };
 
@@ -633,8 +727,8 @@
 void ?{}(Fibonacci& this) {
 	this.fn = 0;
-	//Call constructor to initialize coroutine
+	// Call constructor to initialize coroutine
 	(this.c){myMain};
 }
-\end{cfacode}
+\end{cfa}
 The downside of this approach is that users need to correctly construct the coroutine handle before using it.
 Like any other objects, the user must carefully choose construction order to prevent usage of objects not yet constructed.
@@ -645,10 +739,10 @@
 The next alternative is to use language support to annotate coroutines as follows:
 
-\begin{cfacode}
+\begin{cfa}
 coroutine Fibonacci {
-	int fn; //used for communication
+	int fn; // used for communication
 };
-\end{cfacode}
-The \code{coroutine} keyword means the compiler can find and inject code where needed.
+\end{cfa}
+The @coroutine@ keyword means the compiler can find and inject code where needed.
 The downside of this approach is that it makes coroutine a special case in the language.
 Users wanting to extend coroutines or build their own for various reasons can only do so in ways offered by the language.
@@ -661,10 +755,10 @@
 For coroutines as for threads, many implementations are based on routine pointers or function objects~\cite{Butenhof97, C++14, MS:VisualC++, BoostCoroutines15}.
 For example, Boost implements coroutines in terms of four functor object types:
-\begin{cfacode}
+\begin{cfa}
 asymmetric_coroutine<>::pull_type
 asymmetric_coroutine<>::push_type
 symmetric_coroutine<>::call_type
 symmetric_coroutine<>::yield_type
-\end{cfacode}
+\end{cfa}
 Often, the canonical threading paradigm in languages is based on function pointers, \texttt{pthread} being one of the most well-known examples.
 The main problem of this approach is that the thread usage is limited to a generic handle that must otherwise be wrapped in a custom type.
@@ -672,8 +766,8 @@
 
 A variation of this would be to use a simple function pointer in the same way \texttt{pthread} does for threads:
-\begin{cfacode}
+\begin{cfa}
 void foo( coroutine_t cid, void* arg ) {
 	int* value = (int*)arg;
-	//Coroutine body
+	// Coroutine body
 }
 
@@ -683,5 +777,5 @@
 	coroutine_resume( &cid );
 }
-\end{cfacode}
+\end{cfa}
 This semantics is more common for thread interfaces but coroutines work equally well.
 As discussed in section \ref{threads}, this approach is superseded by static approaches in terms of expressivity.
@@ -690,7 +784,7 @@
 
 Finally, the underlying approach, which is the one closest to \CFA idioms, is to use trait-based lazy coroutines.
-This approach defines a coroutine as anything that satisfies the trait \code{is_coroutine} (as defined below) and is used as a coroutine.
-
-\begin{cfacode}
+This approach defines a coroutine as anything that satisfies the trait @is_coroutine@ (as defined below) and is used as a coroutine.
+
+\begin{cfa}
 trait is_coroutine(dtype T) {
       void main(T& this);
@@ -700,17 +794,17 @@
 forall( dtype T | is_coroutine(T) ) void suspend(T&);
 forall( dtype T | is_coroutine(T) ) void resume (T&);
-\end{cfacode}
-This ensures that an object is not a coroutine until \code{resume} is called on the object.
-Correspondingly, any object that is passed to \code{resume} is a coroutine since it must satisfy the \code{is_coroutine} trait to compile.
-The advantage of this approach is that users can easily create different types of coroutines, for example, changing the memory layout of a coroutine is trivial when implementing the \code{get_coroutine} routine.
-The \CFA keyword \code{coroutine} simply has the effect of implementing the getter and forward declarations required for users to implement the main routine.
+\end{cfa}
+This ensures that an object is not a coroutine until @resume@ is called on the object.
+Correspondingly, any object that is passed to @resume@ is a coroutine since it must satisfy the @is_coroutine@ trait to compile.
+The advantage of this approach is that users can easily create different types of coroutines, for example, changing the memory layout of a coroutine is trivial when implementing the @get_coroutine@ routine.
+The \CFA keyword @coroutine@ simply has the effect of implementing the getter and forward declarations required for users to implement the main routine.
 
 \begin{center}
 \begin{tabular}{c c c}
-\begin{cfacode}[tabsize=3]
+\begin{cfa}[tabsize=3]
 coroutine MyCoroutine {
 	int someValue;
 };
-\end{cfacode} & == & \begin{cfacode}[tabsize=3]
+\end{cfa} & == & \begin{cfa}[tabsize=3]
 struct MyCoroutine {
 	int someValue;
@@ -726,5 +820,5 @@
 
 void main(struct MyCoroutine* this);
-\end{cfacode}
+\end{cfa}
 \end{tabular}
 \end{center}
@@ -736,13 +830,13 @@
 Both user and kernel threads are supported, where user threads are the concurrency mechanism and kernel threads are the parallel mechanism.
 User threads offer a flexible and lightweight interface.
-A thread can be declared using a struct declaration \code{thread} as follows:
-
-\begin{cfacode}
+A thread can be declared using a struct declaration @thread@ as follows:
+
+\begin{cfa}
 thread foo {};
-\end{cfacode}
+\end{cfa}
 
 As for coroutines, the keyword is a thin wrapper around a \CFA trait:
 
-\begin{cfacode}
+\begin{cfa}
 trait is_thread(dtype T) {
       void ^?{}(T & mutex this);
@@ -750,12 +844,12 @@
       thread_desc* get_thread(T & this);
 };
-\end{cfacode}
+\end{cfa}
 
 Obviously, for this thread implementation to be useful it must run some user code.
 Several other threading interfaces use a function-pointer representation as the interface of threads (for example \Csharp~\cite{Csharp} and Scala~\cite{Scala}).
-However, this proposal considers that statically tying a \code{main} routine to a thread supersedes this approach.
-Since the \code{main} routine is already a special routine in \CFA (where the program begins), it is a natural extension of the semantics to use overloading to declare mains for different threads (the normal main being the main of the initial thread).
-As such the \code{main} routine of a thread can be defined as
-\begin{cfacode}
+However, this proposal considers that statically tying a @main@ routine to a thread supersedes this approach.
+Since the @main@ routine is already a special routine in \CFA (where the program begins), it is a natural extension of the semantics to use overloading to declare mains for different threads (the normal main being the main of the initial thread).
+As such the @main@ routine of a thread can be defined as
+\begin{cfa}
 thread foo {};
 
@@ -763,9 +857,9 @@
 	sout | "Hello World!" | endl;
 }
-\end{cfacode}
-
-In this example, threads of type \code{foo} start execution in the \code{void main(foo &)} routine, which prints \code{"Hello World!".} While this paper encourages this approach to enforce strongly typed programming, users may prefer to use the routine-based thread semantics for the sake of simplicity.
+\end{cfa}
+
+In this example, threads of type @foo@ start execution in the @void main(foo &)@ routine, which prints @"Hello World!".@ While this paper encourages this approach to enforce strongly typed programming, users may prefer to use the routine-based thread semantics for the sake of simplicity.
 With the static semantics it is trivial to write a thread type that takes a function pointer as a parameter and executes it on its stack asynchronously.
-\begin{cfacode}
+\begin{cfa}
 typedef void (*voidFunc)(int);
 
@@ -781,5 +875,5 @@
 
 void main(FuncRunner & this) {
-	//thread starts here and runs the function
+	// thread starts here and runs the function
 	this.func( this.arg );
 }
@@ -793,12 +887,12 @@
 	return 0?
 }
-\end{cfacode}
+\end{cfa}
 
 A consequence of the strongly typed approach to main is that memory layout of parameters and return values to/from a thread are now explicitly specified in the \textbf{api}.
 
 Of course, for threads to be useful, it must be possible to start and stop threads and wait for them to complete execution.
-While using an \textbf{api} such as \code{fork} and \code{join} is relatively common in the literature, such an interface is unnecessary.
-Indeed, the simplest approach is to use \textbf{raii} principles and have threads \code{fork} after the constructor has completed and \code{join} before the destructor runs.
-\begin{cfacode}
+While using an \textbf{api} such as @fork@ and @join@ is relatively common in the literature, such an interface is unnecessary.
+Indeed, the simplest approach is to use \textbf{raii} principles and have threads @fork@ after the constructor has completed and @join@ before the destructor runs.
+\begin{cfa}
 thread World;
 
@@ -809,21 +903,21 @@
 void main() {
 	World w;
-	//Thread forks here
-
-	//Printing "Hello " and "World!" are run concurrently
+	// Thread forks here
+
+	// Printing "Hello " and "World!" are run concurrently
 	sout | "Hello " | endl;
 
-	//Implicit join at end of scope
-}
-\end{cfacode}
+	// Implicit join at end of scope
+}
+\end{cfa}
 
 This semantic has several advantages over explicit semantics: a thread is always started and stopped exactly once, users cannot make any programming errors, and it naturally scales to multiple threads meaning basic synchronization is very simple.
 
-\begin{cfacode}
+\begin{cfa}
 thread MyThread {
 	//...
 };
 
-//main
+// main
 void main(MyThread& this) {
 	//...
@@ -832,16 +926,16 @@
 void foo() {
 	MyThread thrds[10];
-	//Start 10 threads at the beginning of the scope
+	// Start 10 threads at the beginning of the scope
 
 	DoStuff();
 
-	//Wait for the 10 threads to finish
-}
-\end{cfacode}
+	// Wait for the 10 threads to finish
+}
+\end{cfa}
 
 However, one of the drawbacks of this approach is that threads always form a tree where nodes must always outlive their children, i.e., they are always destroyed in the opposite order of construction because of C scoping rules.
 This restriction is relaxed by using dynamic allocation, so threads can outlive the scope in which they are created, much like dynamically allocating memory lets objects outlive the scope in which they are created.
 
-\begin{cfacode}
+\begin{cfa}
 thread MyThread {
 	//...
@@ -855,20 +949,20 @@
 	MyThread* long_lived;
 	{
-		//Start a thread at the beginning of the scope
+		// Start a thread at the beginning of the scope
 		MyThread short_lived;
 
-		//create another thread that will outlive the thread in this scope
+		// create another thread that will outlive the thread in this scope
 		long_lived = new MyThread;
 
 		DoStuff();
 
-		//Wait for the thread short_lived to finish
+		// Wait for the thread short_lived to finish
 	}
 	DoMoreStuff();
 
-	//Now wait for the long_lived to finish
+	// Now wait for the long_lived to finish
 	delete long_lived;
 }
-\end{cfacode}
+\end{cfa}
 
 
@@ -888,5 +982,5 @@
 At the lowest level, concurrent paradigms are implemented as atomic operations and locks.
 Many such mechanisms have been proposed, including semaphores~\cite{Dijkstra68b} and path expressions~\cite{Campbell74}.
-However, for productivity reasons it is desirable to have a higher-level construct be the core concurrency paradigm~\cite{HPP:Study}.
+However, for productivity reasons it is desirable to have a higher-level construct be the core concurrency paradigm~\cite{Hochstein05}.
 
 An approach that is worth mentioning because it is gaining in popularity is transactional memory~\cite{Herlihy93}.
@@ -909,5 +1003,5 @@
 Methods range from low-level locks, which are fast and flexible but require significant attention to be correct, to  higher-level concurrency techniques, which sacrifice some performance in order to improve ease of use.
 Ease of use comes by either guaranteeing some problems cannot occur (e.g., being deadlock free) or by offering a more explicit coupling between data and corresponding critical section.
-For example, the \CC \code{std::atomic<T>} offers an easy way to express mutual-exclusion on a restricted set of operations (e.g., reading/writing large types atomically).
+For example, the \CC @std::atomic<T>@ offers an easy way to express mutual-exclusion on a restricted set of operations (e.g., reading/writing large types atomically).
 Another challenge with low-level locks is composability.
 Locks have restricted composability because it takes careful organizing for multiple locks to be used while preventing deadlocks.
@@ -938,13 +1032,13 @@
 This concept is generally associated with object-oriented languages like Java~\cite{Java} or \uC~\cite{uC++book} but does not strictly require OO semantics.
 The only requirement is the ability to declare a handle to a shared object and a set of routines that act on it:
-\begin{cfacode}
+\begin{cfa}
 typedef /*some monitor type*/ monitor;
 int f(monitor & m);
 
 int main() {
-	monitor m;  //Handle m
-	f(m);       //Routine using handle
-}
-\end{cfacode}
+	monitor m;  // Handle m
+	f(m);       // Routine using handle
+}
+\end{cfa}
 
 % ======================================================================
@@ -956,27 +1050,27 @@
 First, it is necessary to use pass-by-reference over pass-by-value for monitor routines.
 This semantics is important, because at their core, monitors are implicit mutual-exclusion objects (locks), and these objects cannot be copied.
-Therefore, monitors are non-copy-able objects (\code{dtype}).
+Therefore, monitors are non-copy-able objects (@dtype@).
 
 Another aspect to consider is when a monitor acquires its mutual exclusion.
 For example, a monitor may need to be passed through multiple helper routines that do not acquire the monitor mutual-exclusion on entry.
-Passthrough can occur for generic helper routines (\code{swap}, \code{sort}, etc.) or specific helper routines like the following to implement an atomic counter:
-
-\begin{cfacode}
+Passthrough can occur for generic helper routines (@swap@, @sort@, etc.) or specific helper routines like the following to implement an atomic counter:
+
+\begin{cfa}
 monitor counter_t { /*...see section $\ref{data}$...*/ };
 
-void ?{}(counter_t & nomutex this); //constructor
-size_t ++?(counter_t & mutex this); //increment
-
-//need for mutex is platform dependent
-void ?{}(size_t * this, counter_t & mutex cnt); //conversion
-\end{cfacode}
+void ?{}(counter_t & nomutex this); // constructor
+size_t ++?(counter_t & mutex this); // increment
+
+// need for mutex is platform dependent
+void ?{}(size_t * this, counter_t & mutex cnt); // conversion
+\end{cfa}
 This counter is used as follows:
 \begin{center}
 \begin{tabular}{c @{\hskip 0.35in} c @{\hskip 0.35in} c}
-\begin{cfacode}
-//shared counter
+\begin{cfa}
+// shared counter
 counter_t cnt1, cnt2;
 
-//multiple threads access counter
+// multiple threads access counter
 thread 1 : cnt1++; cnt2++;
 thread 2 : cnt1++; cnt2++;
@@ -984,20 +1078,20 @@
 	...
 thread N : cnt1++; cnt2++;
-\end{cfacode}
+\end{cfa}
 \end{tabular}
 \end{center}
-Notice how the counter is used without any explicit synchronization and yet supports thread-safe semantics for both reading and writing, which is similar in usage to the \CC template \code{std::atomic}.
-
-Here, the constructor (\code{?\{\}}) uses the \code{nomutex} keyword to signify that it does not acquire the monitor mutual-exclusion when constructing.
-This semantics is because an object not yet con\-structed should never be shared and therefore does not require mutual exclusion.
+Notice how the counter is used without any explicit synchronization and yet supports thread-safe semantics for both reading and writing, which is similar in usage to the \CC template @std::atomic@.
+
+Here, the constructor (@?{}@) uses the @nomutex@ keyword to signify that it does not acquire the monitor mutual-exclusion when constructing.
+This semantics is because an object not yet constructed should never be shared and therefore does not require mutual exclusion.
 Furthermore, it allows the implementation greater freedom when it initializes the monitor locking.
-The prefix increment operator uses \code{mutex} to protect the incrementing process from race conditions.
-Finally, there is a conversion operator from \code{counter_t} to \code{size_t}.
-This conversion may or may not require the \code{mutex} keyword depending on whether or not reading a \code{size_t} is an atomic operation.
+The prefix increment operator uses @mutex@ to protect the incrementing process from race conditions.
+Finally, there is a conversion operator from @counter_t@ to @size_t@.
+This conversion may or may not require the @mutex@ keyword depending on whether or not reading a @size_t@ is an atomic operation.
 
 For maximum usability, monitors use \textbf{multi-acq} semantics, which means a single thread can acquire the same monitor multiple times without deadlock.
 For example, listing \ref{fig:search} uses recursion and \textbf{multi-acq} to print values inside a binary tree.
 \begin{figure}
-\begin{cfacode}[caption={Recursive printing algorithm using \textbf{multi-acq}.},label={fig:search}]
+\begin{cfa}[caption={Recursive printing algorithm using \textbf{multi-acq}.},label={fig:search}]
 monitor printer { ... };
 struct tree {
@@ -1012,10 +1106,10 @@
 	print(p, t->right);
 }
-\end{cfacode}
+\end{cfa}
 \end{figure}
 
-Having both \code{mutex} and \code{nomutex} keywords can be redundant, depending on the meaning of a routine having neither of these keywords.
-For example, it is reasonable that it should default to the safest option (\code{mutex}) when given a routine without qualifiers \code{void foo(counter_t & this)}, whereas assuming \code{nomutex} is unsafe and may cause subtle errors.
-On the other hand, \code{nomutex} is the ``normal'' parameter behaviour, it effectively states explicitly that ``this routine is not special''.
+Having both @mutex@ and @nomutex@ keywords can be redundant, depending on the meaning of a routine having neither of these keywords.
+For example, it is reasonable that it should default to the safest option (@mutex@) when given a routine without qualifiers @void foo(counter_t & this)@, whereas assuming @nomutex@ is unsafe and may cause subtle errors.
+On the other hand, @nomutex@ is the ``normal'' parameter behaviour, it effectively states explicitly that ``this routine is not special''.
 Another alternative is making exactly one of these keywords mandatory, which provides the same semantics but without the ambiguity of supporting routines with neither keyword.
 Mandatory keywords would also have the added benefit of being self-documented but at the cost of extra typing.
@@ -1023,9 +1117,9 @@
 Mandatory keywords in \CFA would imply that the compiler must know without doubt whether or not a parameter is a monitor or not.
 Since \CFA relies heavily on traits as an abstraction mechanism, the distinction between a type that is a monitor and a type that looks like a monitor can become blurred.
-For this reason, \CFA only has the \code{mutex} keyword and uses no keyword to mean \code{nomutex}.
-
-The next semantic decision is to establish when \code{mutex} may be used as a type qualifier.
+For this reason, \CFA only has the @mutex@ keyword and uses no keyword to mean @nomutex@.
+
+The next semantic decision is to establish when @mutex@ may be used as a type qualifier.
 Consider the following declarations:
-\begin{cfacode}
+\begin{cfa}
 int f1(monitor & mutex m);
 int f2(const monitor & mutex m);
@@ -1033,23 +1127,23 @@
 int f4(monitor * mutex m []);
 int f5(graph(monitor *) & mutex m);
-\end{cfacode}
+\end{cfa}
 The problem is to identify which object(s) should be acquired.
 Furthermore, each object needs to be acquired only once.
-In the case of simple routines like \code{f1} and \code{f2} it is easy to identify an exhaustive list of objects to acquire on entry.
-Adding indirections (\code{f3}) still allows the compiler and programmer to identify which object is acquired.
-However, adding in arrays (\code{f4}) makes it much harder.
+In the case of simple routines like @f1@ and @f2@ it is easy to identify an exhaustive list of objects to acquire on entry.
+Adding indirections (@f3@) still allows the compiler and programmer to identify which object is acquired.
+However, adding in arrays (@f4@) makes it much harder.
 Array lengths are not necessarily known in C, and even then, making sure objects are only acquired once becomes none-trivial.
-This problem can be extended to absurd limits like \code{f5}, which uses a graph of monitors.
+This problem can be extended to absurd limits like @f5@, which uses a graph of monitors.
 To make the issue tractable, this project imposes the requirement that a routine may only acquire one monitor per parameter and it must be the type of the parameter with at most one level of indirection (ignoring potential qualifiers).
-Also note that while routine \code{f3} can be supported, meaning that monitor \code{**m} is acquired, passing an array to this routine would be type-safe and yet result in undefined behaviour because only the first element of the array is acquired.
+Also note that while routine @f3@ can be supported, meaning that monitor @**m@ is acquired, passing an array to this routine would be type-safe and yet result in undefined behaviour because only the first element of the array is acquired.
 However, this ambiguity is part of the C type-system with respects to arrays.
-For this reason, \code{mutex} is disallowed in the context where arrays may be passed:
-\begin{cfacode}
-int f1(monitor & mutex m);    //Okay : recommended case
-int f2(monitor * mutex m);    //Not Okay : Could be an array
-int f3(monitor mutex m []);  //Not Okay : Array of unknown length
-int f4(monitor ** mutex m);   //Not Okay : Could be an array
-int f5(monitor * mutex m []); //Not Okay : Array of unknown length
-\end{cfacode}
+For this reason, @mutex@ is disallowed in the context where arrays may be passed:
+\begin{cfa}
+int f1(monitor & mutex m);    // Okay : recommended case
+int f2(monitor * mutex m);    // Not Okay : Could be an array
+int f3(monitor mutex m []);  // Not Okay : Array of unknown length
+int f4(monitor ** mutex m);   // Not Okay : Could be an array
+int f5(monitor * mutex m []); // Not Okay : Array of unknown length
+\end{cfa}
 Note that not all array functions are actually distinct in the type system.
 However, even if the code generation could tell the difference, the extra information is still not sufficient to extend meaningfully the monitor call semantic.
@@ -1057,5 +1151,5 @@
 Unlike object-oriented monitors, where calling a mutex member \emph{implicitly} acquires mutual-exclusion of the receiver object, \CFA uses an explicit mechanism to specify the object that acquires mutual-exclusion.
 A consequence of this approach is that it extends naturally to multi-monitor calls.
-\begin{cfacode}
+\begin{cfa}
 int f(MonitorA & mutex a, MonitorB & mutex b);
 
@@ -1063,5 +1157,5 @@
 MonitorB b;
 f(a,b);
-\end{cfacode}
+\end{cfa}
 While OO monitors could be extended with a mutex qualifier for multiple-monitor calls, no example of this feature could be found.
 The capability to acquire multiple locks before entering a critical section is called \emph{\textbf{bulk-acq}}.
@@ -1071,23 +1165,23 @@
 This consistent ordering means acquiring multiple monitors is safe from deadlock when using \textbf{bulk-acq}.
 However, users can still force the acquiring order.
-For example, notice which routines use \code{mutex}/\code{nomutex} and how this affects acquiring order:
-\begin{cfacode}
-void foo(A& mutex a, B& mutex b) { //acquire a & b
+For example, notice which routines use @mutex@/@nomutex@ and how this affects acquiring order:
+\begin{cfa}
+void foo(A& mutex a, B& mutex b) { // acquire a & b
 	...
 }
 
-void bar(A& mutex a, B& /*nomutex*/ b) { //acquire a
-	... foo(a, b); ... //acquire b
-}
-
-void baz(A& /*nomutex*/ a, B& mutex b) { //acquire b
-	... foo(a, b); ... //acquire a
-}
-\end{cfacode}
-The \textbf{multi-acq} monitor lock allows a monitor lock to be acquired by both \code{bar} or \code{baz} and acquired again in \code{foo}.
-In the calls to \code{bar} and \code{baz} the monitors are acquired in opposite order.
+void bar(A& mutex a, B& /*nomutex*/ b) { // acquire a
+	... foo(a, b); ... // acquire b
+}
+
+void baz(A& /*nomutex*/ a, B& mutex b) { // acquire b
+	... foo(a, b); ... // acquire a
+}
+\end{cfa}
+The \textbf{multi-acq} monitor lock allows a monitor lock to be acquired by both @bar@ or @baz@ and acquired again in @foo@.
+In the calls to @bar@ and @baz@ the monitors are acquired in opposite order.
 
 However, such use leads to lock acquiring order problems.
-In the example above, the user uses implicit ordering in the case of function \code{foo} but explicit ordering in the case of \code{bar} and \code{baz}.
+In the example above, the user uses implicit ordering in the case of function @foo@ but explicit ordering in the case of @bar@ and @baz@.
 This subtle difference means that calling these routines concurrently may lead to deadlock and is therefore undefined behaviour.
 As shown~\cite{Lister77}, solving this problem requires:
@@ -1101,5 +1195,5 @@
 
 For example, \textbf{multi-acq} and \textbf{bulk-acq} can be used together in interesting ways:
-\begin{cfacode}
+\begin{cfa}
 monitor bank { ... };
 
@@ -1110,23 +1204,24 @@
 	deposit( yourbank, me2you );
 }
-\end{cfacode}
+\end{cfa}
 This example shows a trivial solution to the bank-account transfer problem~\cite{BankTransfer}.
 Without \textbf{multi-acq} and \textbf{bulk-acq}, the solution to this problem is much more involved and requires careful engineering.
 
-\subsection{\code{mutex} statement} \label{mutex-stmt}
-
-The call semantics discussed above have one software engineering issue: only a routine can acquire the mutual-exclusion of a set of monitor. \CFA offers the \code{mutex} statement to work around the need for unnecessary names, avoiding a major software engineering problem~\cite{2FTwoHardThings}.
-Table \ref{lst:mutex-stmt} shows an example of the \code{mutex} statement, which introduces a new scope in which the mutual-exclusion of a set of monitor is acquired.
-Beyond naming, the \code{mutex} statement has no semantic difference from a routine call with \code{mutex} parameters.
+
+\subsection{\protect\lstinline|mutex| statement} \label{mutex-stmt}
+
+The call semantics discussed above have one software engineering issue: only a routine can acquire the mutual-exclusion of a set of monitor. \CFA offers the @mutex@ statement to work around the need for unnecessary names, avoiding a major software engineering problem~\cite{2FTwoHardThings}.
+Table \ref{lst:mutex-stmt} shows an example of the @mutex@ statement, which introduces a new scope in which the mutual-exclusion of a set of monitor is acquired.
+Beyond naming, the @mutex@ statement has no semantic difference from a routine call with @mutex@ parameters.
 
 \begin{table}
 \begin{center}
 \begin{tabular}{|c|c|}
-function call & \code{mutex} statement \\
+function call & @mutex@ statement \\
 \hline
-\begin{cfacode}[tabsize=3]
+\begin{cfa}[tabsize=3]
 monitor M {};
 void foo( M & mutex m1, M & mutex m2 ) {
-	//critical section
+	// critical section
 }
 
@@ -1134,17 +1229,17 @@
 	foo( m1, m2 );
 }
-\end{cfacode}&\begin{cfacode}[tabsize=3]
+\end{cfa}&\begin{cfa}[tabsize=3]
 monitor M {};
 void bar( M & m1, M & m2 ) {
 	mutex(m1, m2) {
-		//critical section
-	}
-}
-
-
-\end{cfacode}
+		// critical section
+	}
+}
+
+
+\end{cfa}
 \end{tabular}
 \end{center}
-\caption{Regular call semantics vs. \code{mutex} statement}
+\caption{Regular call semantics vs. \protect\lstinline|mutex| statement}
 \label{lst:mutex-stmt}
 \end{table}
@@ -1159,5 +1254,5 @@
 This data should be intrinsic to the monitor declaration to prevent any accidental use of data without its appropriate protection.
 For example, here is a complete version of the counter shown in section \ref{call}:
-\begin{cfacode}
+\begin{cfa}
 monitor counter_t {
 	int value;
@@ -1172,20 +1267,20 @@
 }
 
-//need for mutex is platform dependent here
+// need for mutex is platform dependent here
 void ?{}(int * this, counter_t & mutex cnt) {
 	*this = (int)cnt;
 }
-\end{cfacode}
-
-Like threads and coroutines, monitors are defined in terms of traits with some additional language support in the form of the \code{monitor} keyword.
+\end{cfa}
+
+Like threads and coroutines, monitors are defined in terms of traits with some additional language support in the form of the @monitor@ keyword.
 The monitor trait is:
-\begin{cfacode}
+\begin{cfa}
 trait is_monitor(dtype T) {
 	monitor_desc * get_monitor( T & );
 	void ^?{}( T & mutex );
 };
-\end{cfacode}
-Note that the destructor of a monitor must be a \code{mutex} routine to prevent deallocation while a thread is accessing the monitor.
-As with any object, calls to a monitor, using \code{mutex} or otherwise, is undefined behaviour after the destructor has run.
+\end{cfa}
+Note that the destructor of a monitor must be a @mutex@ routine to prevent deallocation while a thread is accessing the monitor.
+As with any object, calls to a monitor, using @mutex@ or otherwise, is undefined behaviour after the destructor has run.
 
 % ======================================================================
@@ -1202,5 +1297,5 @@
 First, here is a simple example of internal scheduling:
 
-\begin{cfacode}
+\begin{cfa}
 monitor A {
 	condition e;
@@ -1209,5 +1304,5 @@
 void foo(A& mutex a1, A& mutex a2) {
 	...
-	//Wait for cooperation from bar()
+	// Wait for cooperation from bar()
 	wait(a1.e);
 	...
@@ -1215,18 +1310,18 @@
 
 void bar(A& mutex a1, A& mutex a2) {
-	//Provide cooperation for foo()
+	// Provide cooperation for foo()
 	...
-	//Unblock foo
+	// Unblock foo
 	signal(a1.e);
 }
-\end{cfacode}
+\end{cfa}
 There are two details to note here.
-First, \code{signal} is a delayed operation; it only unblocks the waiting thread when it reaches the end of the critical section.
+First, @signal@ is a delayed operation; it only unblocks the waiting thread when it reaches the end of the critical section.
 This semantics is needed to respect mutual-exclusion, i.e., the signaller and signalled thread cannot be in the monitor simultaneously.
-The alternative is to return immediately after the call to \code{signal}, which is significantly more restrictive.
-Second, in \CFA, while it is common to store a \code{condition} as a field of the monitor, a \code{condition} variable can be stored/created independently of a monitor.
-Here routine \code{foo} waits for the \code{signal} from \code{bar} before making further progress, ensuring a basic ordering.
-
-An important aspect of the implementation is that \CFA does not allow barging, which means that once function \code{bar} releases the monitor, \code{foo} is guaranteed to be the next thread to acquire the monitor (unless some other thread waited on the same condition).
+The alternative is to return immediately after the call to @signal@, which is significantly more restrictive.
+Second, in \CFA, while it is common to store a @condition@ as a field of the monitor, a @condition@ variable can be stored/created independently of a monitor.
+Here routine @foo@ waits for the @signal@ from @bar@ before making further progress, ensuring a basic ordering.
+
+An important aspect of the implementation is that \CFA does not allow barging, which means that once function @bar@ releases the monitor, @foo@ is guaranteed to be the next thread to acquire the monitor (unless some other thread waited on the same condition).
 This guarantee offers the benefit of not having to loop around waits to recheck that a condition is met.
 The main reason \CFA offers this guarantee is that users can easily introduce barging if it becomes a necessity but adding barging prevention or barging avoidance is more involved without language support.
@@ -1240,5 +1335,5 @@
 It is easy to understand the problem of multi-monitor scheduling using a series of pseudo-code examples.
 Note that for simplicity in the following snippets of pseudo-code, waiting and signalling is done using an implicit condition variable, like Java built-in monitors.
-Indeed, \code{wait} statements always use the implicit condition variable as parameters and explicitly name the monitors (A and B) associated with the condition.
+Indeed, @wait@ statements always use the implicit condition variable as parameters and explicitly name the monitors (A and B) associated with the condition.
 Note that in \CFA, condition variables are tied to a \emph{group} of monitors on first use (called branding), which means that using internal scheduling with distinct sets of monitors requires one condition variable per set of monitors.
 The example below shows the simple case of having two threads (one for each column) and a single monitor A.
@@ -1246,36 +1341,36 @@
 \begin{multicols}{2}
 thread 1
-\begin{pseudo}
+\begin{cfa}
 acquire A
 	wait A
 release A
-\end{pseudo}
+\end{cfa}
 
 \columnbreak
 
 thread 2
-\begin{pseudo}
+\begin{cfa}
 acquire A
 	signal A
 release A
-\end{pseudo}
+\end{cfa}
 \end{multicols}
 One thread acquires before waiting (atomically blocking and releasing A) and the other acquires before signalling.
-It is important to note here that both \code{wait} and \code{signal} must be called with the proper monitor(s) already acquired.
+It is important to note here that both @wait@ and @signal@ must be called with the proper monitor(s) already acquired.
 This semantic is a logical requirement for barging prevention.
 
 A direct extension of the previous example is a \textbf{bulk-acq} version:
 \begin{multicols}{2}
-\begin{pseudo}
+\begin{cfa}
 acquire A & B
 	wait A & B
 release A & B
-\end{pseudo}
+\end{cfa}
 \columnbreak
-\begin{pseudo}
+\begin{cfa}
 acquire A & B
 	signal A & B
 release A & B
-\end{pseudo}
+\end{cfa}
 \end{multicols}
 \noindent This version uses \textbf{bulk-acq} (denoted using the {\sf\&} symbol), but the presence of multiple monitors does not add a particularly new meaning.
@@ -1285,8 +1380,8 @@
 
 While deadlock issues can occur when nesting monitors, these issues are only a symptom of the fact that locks, and by extension monitors, are not perfectly composable.
-For monitors, a well-known deadlock problem is the Nested Monitor Problem~\cite{Lister77}, which occurs when a \code{wait} is made by a thread that holds more than one monitor.
-For example, the following pseudo-code runs into the nested-monitor problem:
+For monitors, a well-known deadlock problem is the Nested Monitor Problem~\cite{Lister77}, which occurs when a @wait@ is made by a thread that holds more than one monitor.
+For example, the following cfa-code runs into the nested-monitor problem:
 \begin{multicols}{2}
-\begin{pseudo}
+\begin{cfa}
 acquire A
 	acquire B
@@ -1294,9 +1389,9 @@
 	release B
 release A
-\end{pseudo}
+\end{cfa}
 
 \columnbreak
 
-\begin{pseudo}
+\begin{cfa}
 acquire A
 	acquire B
@@ -1304,14 +1399,14 @@
 	release B
 release A
-\end{pseudo}
+\end{cfa}
 \end{multicols}
-\noindent The \code{wait} only releases monitor \code{B} so the signalling thread cannot acquire monitor \code{A} to get to the \code{signal}.
-Attempting release of all acquired monitors at the \code{wait} introduces a different set of problems, such as releasing monitor \code{C}, which has nothing to do with the \code{signal}.
+\noindent The @wait@ only releases monitor @B@ so the signalling thread cannot acquire monitor @A@ to get to the @signal@.
+Attempting release of all acquired monitors at the @wait@ introduces a different set of problems, such as releasing monitor @C@, which has nothing to do with the @signal@.
 
 However, for monitors as for locks, it is possible to write a program using nesting without encountering any problems if nesting is done correctly.
-For example, the next pseudo-code snippet acquires monitors {\sf A} then {\sf B} before waiting, while only acquiring {\sf B} when signalling, effectively avoiding the Nested Monitor Problem~\cite{Lister77}.
+For example, the next cfa-code snippet acquires monitors {\sf A} then {\sf B} before waiting, while only acquiring {\sf B} when signalling, effectively avoiding the Nested Monitor Problem~\cite{Lister77}.
 
 \begin{multicols}{2}
-\begin{pseudo}
+\begin{cfa}
 acquire A
 	acquire B
@@ -1319,9 +1414,9 @@
 	release B
 release A
-\end{pseudo}
+\end{cfa}
 
 \columnbreak
 
-\begin{pseudo}
+\begin{cfa}
 
 acquire B
@@ -1329,5 +1424,5 @@
 release B
 
-\end{pseudo}
+\end{cfa}
 \end{multicols}
 
@@ -1341,76 +1436,76 @@
 
 A larger example is presented to show complex issues for \textbf{bulk-acq} and its implementation options are analyzed.
-Listing \ref{lst:int-bulk-pseudo} shows an example where \textbf{bulk-acq} adds a significant layer of complexity to the internal signalling semantics, and listing \ref{lst:int-bulk-cfa} shows the corresponding \CFA code to implement the pseudo-code in listing \ref{lst:int-bulk-pseudo}.
-For the purpose of translating the given pseudo-code into \CFA-code, any method of introducing a monitor is acceptable, e.g., \code{mutex} parameters, global variables, pointer parameters, or using locals with the \code{mutex} statement.
+Listing \ref{lst:int-bulk-cfa} shows an example where \textbf{bulk-acq} adds a significant layer of complexity to the internal signalling semantics, and listing \ref{lst:int-bulk-cfa} shows the corresponding \CFA code to implement the cfa-code in listing \ref{lst:int-bulk-cfa}.
+For the purpose of translating the given cfa-code into \CFA-code, any method of introducing a monitor is acceptable, e.g., @mutex@ parameters, global variables, pointer parameters, or using locals with the @mutex@ statement.
 
 \begin{figure}[!t]
 \begin{multicols}{2}
 Waiting thread
-\begin{pseudo}[numbers=left]
+\begin{cfa}[numbers=left]
 acquire A
-	//Code Section 1
+	// Code Section 1
 	acquire A & B
-		//Code Section 2
+		// Code Section 2
 		wait A & B
-		//Code Section 3
+		// Code Section 3
 	release A & B
-	//Code Section 4
+	// Code Section 4
 release A
-\end{pseudo}
+\end{cfa}
 \columnbreak
 Signalling thread
-\begin{pseudo}[numbers=left, firstnumber=10,escapechar=|]
+\begin{cfa}[numbers=left, firstnumber=10,escapechar=|]
 acquire A
-	//Code Section 5
+	// Code Section 5
 	acquire A & B
-		//Code Section 6
+		// Code Section 6
 		|\label{line:signal1}|signal A & B
-		//Code Section 7
+		// Code Section 7
 	|\label{line:releaseFirst}|release A & B
-	//Code Section 8
+	// Code Section 8
 |\label{line:lastRelease}|release A
-\end{pseudo}
+\end{cfa}
 \end{multicols}
-\begin{cfacode}[caption={Internal scheduling with \textbf{bulk-acq}},label={lst:int-bulk-pseudo}]
-\end{cfacode}
+\begin{cfa}[caption={Internal scheduling with \textbf{bulk-acq}},label={lst:int-bulk-cfa}]
+\end{cfa}
 \begin{center}
-\begin{cfacode}[xleftmargin=.4\textwidth]
+\begin{cfa}[xleftmargin=.4\textwidth]
 monitor A a;
 monitor B b;
 condition c;
-\end{cfacode}
+\end{cfa}
 \end{center}
 \begin{multicols}{2}
 Waiting thread
-\begin{cfacode}
+\begin{cfa}
 mutex(a) {
-	//Code Section 1
+	// Code Section 1
 	mutex(a, b) {
-		//Code Section 2
+		// Code Section 2
 		wait(c);
-		//Code Section 3
-	}
-	//Code Section 4
-}
-\end{cfacode}
+		// Code Section 3
+	}
+	// Code Section 4
+}
+\end{cfa}
 \columnbreak
 Signalling thread
-\begin{cfacode}
+\begin{cfa}
 mutex(a) {
-	//Code Section 5
+	// Code Section 5
 	mutex(a, b) {
-		//Code Section 6
+		// Code Section 6
 		signal(c);
-		//Code Section 7
-	}
-	//Code Section 8
-}
-\end{cfacode}
+		// Code Section 7
+	}
+	// Code Section 8
+}
+\end{cfa}
 \end{multicols}
-\begin{cfacode}[caption={Equivalent \CFA code for listing \ref{lst:int-bulk-pseudo}},label={lst:int-bulk-cfa}]
-\end{cfacode}
+\begin{cfa}[caption={Equivalent \CFA code for listing \ref{lst:int-bulk-cfa}},label={lst:int-bulk-cfa}]
+\end{cfa}
 \begin{multicols}{2}
 Waiter
-\begin{pseudo}[numbers=left]
+\begin{cfa}[numbers=left]
 acquire A
 	acquire A & B
@@ -1418,27 +1513,27 @@
 	release A & B
 release A
-\end{pseudo}
+\end{cfa}
 
 \columnbreak
 
 Signaller
-\begin{pseudo}[numbers=left, firstnumber=6,escapechar=|]
+\begin{cfa}[numbers=left, firstnumber=6,escapechar=|]
 acquire A
 	acquire A & B
 		signal A & B
 	release A & B
-	|\label{line:secret}|//Secretly keep B here
+	|\label{line:secret}|// Secretly keep B here
 release A
-//Wakeup waiter and transfer A & B
-\end{pseudo}
+// Wakeup waiter and transfer A & B
+\end{cfa}
 \end{multicols}
-\begin{cfacode}[caption={Listing \ref{lst:int-bulk-pseudo}, with delayed signalling comments},label={lst:int-secret}]
-\end{cfacode}
+\begin{cfa}[caption={Listing \ref{lst:int-bulk-cfa}, with delayed signalling comments},label={lst:int-secret}]
+\end{cfa}
 \end{figure}
 
-The complexity begins at code sections 4 and 8 in listing \ref{lst:int-bulk-pseudo}, which are where the existing semantics of internal scheduling needs to be extended for multiple monitors.
-The root of the problem is that \textbf{bulk-acq} is used in a context where one of the monitors is already acquired, which is why it is important to define the behaviour of the previous pseudo-code.
-When the signaller thread reaches the location where it should ``release \code{A & B}'' (listing \ref{lst:int-bulk-pseudo} line \ref{line:releaseFirst}), it must actually transfer ownership of monitor \code{B} to the waiting thread.
-This ownership transfer is required in order to prevent barging into \code{B} by another thread, since both the signalling and signalled threads still need monitor \code{A}.
+The complexity begins at code sections 4 and 8 in listing \ref{lst:int-bulk-cfa}, which are where the existing semantics of internal scheduling needs to be extended for multiple monitors.
+The root of the problem is that \textbf{bulk-acq} is used in a context where one of the monitors is already acquired, which is why it is important to define the behaviour of the previous cfa-code.
+When the signaller thread reaches the location where it should ``release @A & B@'' (listing \ref{lst:int-bulk-cfa} line \ref{line:releaseFirst}), it must actually transfer ownership of monitor @B@ to the waiting thread.
+This ownership transfer is required in order to prevent barging into @B@ by another thread, since both the signalling and signalled threads still need monitor @A@.
 There are three options:
 
@@ -1452,10 +1547,10 @@
 
 However, listing \ref{lst:int-secret} shows this solution can become much more complicated depending on what is executed while secretly holding B at line \ref{line:secret}, while avoiding the need to transfer ownership of a subset of the condition monitors.
-Listing \ref{lst:dependency} shows a slightly different example where a third thread is waiting on monitor \code{A}, using a different condition variable.
-Because the third thread is signalled when secretly holding \code{B}, the goal  becomes unreachable.
+Listing \ref{lst:dependency} shows a slightly different example where a third thread is waiting on monitor @A@, using a different condition variable.
+Because the third thread is signalled when secretly holding @B@, the goal  becomes unreachable.
 Depending on the order of signals (listing \ref{lst:dependency} line \ref{line:signal-ab} and \ref{line:signal-a}) two cases can happen:
 
-\paragraph{Case 1: thread $\alpha$ goes first.} In this case, the problem is that monitor \code{A} needs to be passed to thread $\beta$ when thread $\alpha$ is done with it.
-\paragraph{Case 2: thread $\beta$ goes first.} In this case, the problem is that monitor \code{B} needs to be retained and passed to thread $\alpha$ along with monitor \code{A}, which can be done directly or possibly using thread $\beta$ as an intermediate.
+\paragraph{Case 1: thread $\alpha$ goes first.} In this case, the problem is that monitor @A@ needs to be passed to thread $\beta$ when thread $\alpha$ is done with it.
+\paragraph{Case 2: thread $\beta$ goes first.} In this case, the problem is that monitor @B@ needs to be retained and passed to thread $\alpha$ along with monitor @A@, which can be done directly or possibly using thread $\beta$ as an intermediate.
 \\
 
@@ -1471,5 +1566,5 @@
 \begin{multicols}{3}
 Thread $\alpha$
-\begin{pseudo}[numbers=left, firstnumber=1]
+\begin{cfa}[numbers=left, firstnumber=1]
 acquire A
 	acquire A & B
@@ -1477,8 +1572,8 @@
 	release A & B
 release A
-\end{pseudo}
+\end{cfa}
 \columnbreak
 Thread $\gamma$
-\begin{pseudo}[numbers=left, firstnumber=6, escapechar=|]
+\begin{cfa}[numbers=left, firstnumber=6, escapechar=|]
 acquire A
 	acquire A & B
@@ -1487,15 +1582,15 @@
 	|\label{line:signal-a}|signal A
 |\label{line:release-a}|release A
-\end{pseudo}
+\end{cfa}
 \columnbreak
 Thread $\beta$
-\begin{pseudo}[numbers=left, firstnumber=12, escapechar=|]
+\begin{cfa}[numbers=left, firstnumber=12, escapechar=|]
 acquire A
 	wait A
 |\label{line:release-aa}|release A
-\end{pseudo}
+\end{cfa}
 \end{multicols}
-\begin{cfacode}[caption={Pseudo-code for the three thread example.},label={lst:dependency}]
-\end{cfacode}
+\begin{cfa}[caption={Pseudo-code for the three thread example.},label={lst:dependency}]
+\end{cfa}
 \begin{center}
 \input{dependency}
@@ -1505,6 +1600,6 @@
 \end{figure}
 
-In listing \ref{lst:int-bulk-pseudo}, there is a solution that satisfies both barging prevention and mutual exclusion.
-If ownership of both monitors is transferred to the waiter when the signaller releases \code{A & B} and then the waiter transfers back ownership of \code{A} back to the signaller when it releases it, then the problem is solved (\code{B} is no longer in use at this point).
+In listing \ref{lst:int-bulk-cfa}, there is a solution that satisfies both barging prevention and mutual exclusion.
+If ownership of both monitors is transferred to the waiter when the signaller releases @A & B@ and then the waiter transfers back ownership of @A@ back to the signaller when it releases it, then the problem is solved (@B@ is no longer in use at this point).
 Dynamically finding the correct order is therefore the second possible solution.
 The problem is effectively resolving a dependency graph of ownership requirements.
@@ -1514,5 +1609,5 @@
 \begin{figure}
 \begin{multicols}{2}
-\begin{pseudo}
+\begin{cfa}
 acquire A
 	acquire B
@@ -1522,9 +1617,9 @@
 	release B
 release A
-\end{pseudo}
+\end{cfa}
 
 \columnbreak
 
-\begin{pseudo}
+\begin{cfa}
 acquire A
 	acquire B
@@ -1534,8 +1629,8 @@
 	release B
 release A
-\end{pseudo}
+\end{cfa}
 \end{multicols}
-\begin{cfacode}[caption={Extension to three monitors of listing \ref{lst:int-bulk-pseudo}},label={lst:explosion}]
-\end{cfacode}
+\begin{cfa}[caption={Extension to three monitors of listing \ref{lst:int-bulk-cfa}},label={lst:explosion}]
+\end{cfa}
 \end{figure}
 
@@ -1546,5 +1641,5 @@
 \subsubsection{Partial Signalling} \label{partial-sig}
 Finally, the solution that is chosen for \CFA is to use partial signalling.
-Again using listing \ref{lst:int-bulk-pseudo}, the partial signalling solution transfers ownership of monitor \code{B} at lines \ref{line:signal1} to the waiter but does not wake the waiting thread since it is still using monitor \code{A}.
+Again using listing \ref{lst:int-bulk-cfa}, the partial signalling solution transfers ownership of monitor @B@ at lines \ref{line:signal1} to the waiter but does not wake the waiting thread since it is still using monitor @A@.
 Only when it reaches line \ref{line:lastRelease} does it actually wake up the waiting thread.
 This solution has the benefit that complexity is encapsulated into only two actions: passing monitors to the next owner when they should be released and conditionally waking threads if all conditions are met.
@@ -1554,7 +1649,7 @@
 Using partial signalling, listing \ref{lst:dependency} can be solved easily:
 \begin{itemize}
-	\item When thread $\gamma$ reaches line \ref{line:release-ab} it transfers monitor \code{B} to thread $\alpha$ and continues to hold monitor \code{A}.
-	\item When thread $\gamma$ reaches line \ref{line:release-a}  it transfers monitor \code{A} to thread $\beta$  and wakes it up.
-	\item When thread $\beta$  reaches line \ref{line:release-aa} it transfers monitor \code{A} to thread $\alpha$ and wakes it up.
+	\item When thread $\gamma$ reaches line \ref{line:release-ab} it transfers monitor @B@ to thread $\alpha$ and continues to hold monitor @A@.
+	\item When thread $\gamma$ reaches line \ref{line:release-a}  it transfers monitor @A@ to thread $\beta$  and wakes it up.
+	\item When thread $\beta$  reaches line \ref{line:release-aa} it transfers monitor @A@ to thread $\alpha$ and wakes it up.
 \end{itemize}
 
@@ -1566,10 +1661,10 @@
 \begin{table}
 \begin{tabular}{|c|c|}
-\code{signal} & \code{signal_block} \\
+@signal@ & @signal_block@ \\
 \hline
-\begin{cfacode}[tabsize=3]
+\begin{cfa}[tabsize=3]
 monitor DatingService
 {
-	//compatibility codes
+	// compatibility codes
 	enum{ CCodes = 20 };
 
@@ -1582,27 +1677,27 @@
 condition exchange;
 
-int girl(int phoneNo, int ccode)
+int girl(int phoneNo, int cfa)
 {
-	//no compatible boy ?
-	if(empty(boys[ccode]))
+	// no compatible boy ?
+	if(empty(boys[cfa]))
 	{
-		//wait for boy
-		wait(girls[ccode]);
-
-		//make phone number available
+		// wait for boy
+		wait(girls[cfa]);
+
+		// make phone number available
 		girlPhoneNo = phoneNo;
 
-		//wake boy from chair
+		// wake boy from chair
 		signal(exchange);
 	}
 	else
 	{
-		//make phone number available
+		// make phone number available
 		girlPhoneNo = phoneNo;
 
-		//wake boy
-		signal(boys[ccode]);
-
-		//sit in chair
+		// wake boy
+		signal(boys[cfa]);
+
+		// sit in chair
 		wait(exchange);
 	}
@@ -1610,13 +1705,13 @@
 }
 
-int boy(int phoneNo, int ccode)
+int boy(int phoneNo, int cfa)
 {
-	//same as above
-	//with boy/girl interchanged
-}
-\end{cfacode}&\begin{cfacode}[tabsize=3]
+	// same as above
+	// with boy/girl interchanged
+}
+\end{cfa}&\begin{cfa}[tabsize=3]
 monitor DatingService
 {
-	//compatibility codes
+	// compatibility codes
 	enum{ CCodes = 20 };
 
@@ -1627,29 +1722,29 @@
 condition girls[CCodes];
 condition boys [CCodes];
-//exchange is not needed
-
-int girl(int phoneNo, int ccode)
+// exchange is not needed
+
+int girl(int phoneNo, int cfa)
 {
-	//no compatible boy ?
-	if(empty(boys[ccode]))
+	// no compatible boy ?
+	if(empty(boys[cfa]))
 	{
-		//wait for boy
-		wait(girls[ccode]);
-
-		//make phone number available
+		// wait for boy
+		wait(girls[cfa]);
+
+		// make phone number available
 		girlPhoneNo = phoneNo;
 
-		//wake boy from chair
+		// wake boy from chair
 		signal(exchange);
 	}
 	else
 	{
-		//make phone number available
+		// make phone number available
 		girlPhoneNo = phoneNo;
 
-		//wake boy
-		signal_block(boys[ccode]);
-
-		//second handshake unnecessary
+		// wake boy
+		signal_block(boys[cfa]);
+
+		// second handshake unnecessary
 
 	}
@@ -1657,23 +1752,23 @@
 }
 
-int boy(int phoneNo, int ccode)
+int boy(int phoneNo, int cfa)
 {
-	//same as above
-	//with boy/girl interchanged
-}
-\end{cfacode}
+	// same as above
+	// with boy/girl interchanged
+}
+\end{cfa}
 \end{tabular}
-\caption{Dating service example using \code{signal} and \code{signal_block}. }
+\caption{Dating service example using \protect\lstinline|signal| and \protect\lstinline|signal_block|. }
 \label{tbl:datingservice}
 \end{table}
 An important note is that, until now, signalling a monitor was a delayed operation.
-The ownership of the monitor is transferred only when the monitor would have otherwise been released, not at the point of the \code{signal} statement.
-However, in some cases, it may be more convenient for users to immediately transfer ownership to the thread that is waiting for cooperation, which is achieved using the \code{signal_block} routine.
+The ownership of the monitor is transferred only when the monitor would have otherwise been released, not at the point of the @signal@ statement.
+However, in some cases, it may be more convenient for users to immediately transfer ownership to the thread that is waiting for cooperation, which is achieved using the @signal_block@ routine.
 
 The example in table \ref{tbl:datingservice} highlights the difference in behaviour.
-As mentioned, \code{signal} only transfers ownership once the current critical section exits; this behaviour requires additional synchronization when a two-way handshake is needed.
-To avoid this explicit synchronization, the \code{condition} type offers the \code{signal_block} routine, which handles the two-way handshake as shown in the example.
+As mentioned, @signal@ only transfers ownership once the current critical section exits; this behaviour requires additional synchronization when a two-way handshake is needed.
+To avoid this explicit synchronization, the @condition@ type offers the @signal_block@ routine, which handles the two-way handshake as shown in the example.
 This feature removes the need for a second condition variables and simplifies programming.
-Like every other monitor semantic, \code{signal_block} uses barging prevention, which means mutual-exclusion is baton-passed both on the front end and the back end of the call to \code{signal_block}, meaning no other thread can acquire the monitor either before or after the call.
+Like every other monitor semantic, @signal_block@ uses barging prevention, which means mutual-exclusion is baton-passed both on the front end and the back end of the call to @signal_block@, meaning no other thread can acquire the monitor either before or after the call.
 
 % ======================================================================
@@ -1687,5 +1782,5 @@
 Internal Scheduling & External Scheduling & Go\\
 \hline
-\begin{ucppcode}[tabsize=3]
+\begin{uC++}[tabsize=3]
 _Monitor Semaphore {
 	condition c;
@@ -1702,5 +1797,5 @@
 	}
 }
-\end{ucppcode}&\begin{ucppcode}[tabsize=3]
+\end{uC++}&\begin{uC++}[tabsize=3]
 _Monitor Semaphore {
 
@@ -1717,5 +1812,5 @@
 	}
 }
-\end{ucppcode}&\begin{gocode}[tabsize=3]
+\end{uC++}&\begin{Go}[tabsize=3]
 type MySem struct {
 	inUse bool
@@ -1737,9 +1832,9 @@
 	s.inUse = false
 
-	//This actually deadlocks
-	//when single thread
+	// This actually deadlocks
+	// when single thread
 	s.c <- false
 }
-\end{gocode}
+\end{Go}
 \end{tabular}
 \caption{Different forms of scheduling.}
@@ -1748,12 +1843,12 @@
 This method is more constrained and explicit, which helps users reduce the non-deterministic nature of concurrency.
 Indeed, as the following examples demonstrate, external scheduling allows users to wait for events from other threads without the concern of unrelated events occurring.
-External scheduling can generally be done either in terms of control flow (e.g., Ada with \code{accept}, \uC with \code{_Accept}) or in terms of data (e.g., Go with channels).
+External scheduling can generally be done either in terms of control flow (e.g., Ada with @accept@, \uC with @_Accept@) or in terms of data (e.g., Go with channels).
 Of course, both of these paradigms have their own strengths and weaknesses, but for this project, control-flow semantics was chosen to stay consistent with the rest of the languages semantics.
 Two challenges specific to \CFA arise when trying to add external scheduling with loose object definitions and multiple-monitor routines.
-The previous example shows a simple use \code{_Accept} versus \code{wait}/\code{signal} and its advantages.
-Note that while other languages often use \code{accept}/\code{select} as the core external scheduling keyword, \CFA uses \code{waitfor} to prevent name collisions with existing socket \textbf{api}s.
-
-For the \code{P} member above using internal scheduling, the call to \code{wait} only guarantees that \code{V} is the last routine to access the monitor, allowing a third routine, say \code{isInUse()}, acquire mutual exclusion several times while routine \code{P} is waiting.
-On the other hand, external scheduling guarantees that while routine \code{P} is waiting, no other routine than \code{V} can acquire the monitor.
+The previous example shows a simple use @_Accept@ versus @wait@/@signal@ and its advantages.
+Note that while other languages often use @accept@/@select@ as the core external scheduling keyword, \CFA uses @waitfor@ to prevent name collisions with existing socket \textbf{api}s.
+
+For the @P@ member above using internal scheduling, the call to @wait@ only guarantees that @V@ is the last routine to access the monitor, allowing a third routine, say @isInUse()@, acquire mutual exclusion several times while routine @P@ is waiting.
+On the other hand, external scheduling guarantees that while routine @P@ is waiting, no other routine than @V@ can acquire the monitor.
 
 % ======================================================================
@@ -1765,23 +1860,23 @@
 Since \CFA is not object oriented, monitors become both more difficult to implement and less clear for a user:
 
-\begin{cfacode}
+\begin{cfa}
 monitor A {};
 
 void f(A & mutex a);
 void g(A & mutex a) {
-	waitfor(f); //Obvious which f() to wait for
-}
-
-void f(A & mutex a, int); //New different F added in scope
+	waitfor(f); // Obvious which f() to wait for
+}
+
+void f(A & mutex a, int); // New different F added in scope
 void h(A & mutex a) {
-	waitfor(f); //Less obvious which f() to wait for
-}
-\end{cfacode}
+	waitfor(f); // Less obvious which f() to wait for
+}
+\end{cfa}
 
 Furthermore, external scheduling is an example where implementation constraints become visible from the interface.
-Here is the pseudo-code for the entering phase of a monitor:
+Here is the cfa-code for the entering phase of a monitor:
 \begin{center}
 \begin{tabular}{l}
-\begin{pseudo}
+\begin{cfa}
 	if monitor is free
 		enter
@@ -1792,9 +1887,9 @@
 	else
 		block
-\end{pseudo}
+\end{cfa}
 \end{tabular}
 \end{center}
 For the first two conditions, it is easy to implement a check that can evaluate the condition in a few instructions.
-However, a fast check for \pscode{monitor accepts me} is much harder to implement depending on the constraints put on the monitors.
+However, a fast check for @monitor accepts me@ is much harder to implement depending on the constraints put on the monitors.
 Indeed, monitors are often expressed as an entry queue and some acceptor queue as in Figure~\ref{fig:ClassicalMonitor}.
 
@@ -1822,14 +1917,14 @@
 The alternative is to alter the implementation as in Figure~\ref{fig:BulkMonitor}.
 Here, the mutex routine called is associated with a thread on the entry queue while a list of acceptable routines is kept separate.
-Generating a mask dynamically means that the storage for the mask information can vary between calls to \code{waitfor}, allowing for more flexibility and extensions.
+Generating a mask dynamically means that the storage for the mask information can vary between calls to @waitfor@, allowing for more flexibility and extensions.
 Storing an array of accepted function pointers replaces the single instruction bitmask comparison with dereferencing a pointer followed by a linear search.
-Furthermore, supporting nested external scheduling (e.g., listing \ref{lst:nest-ext}) may now require additional searches for the \code{waitfor} statement to check if a routine is already queued.
+Furthermore, supporting nested external scheduling (e.g., listing \ref{lst:nest-ext}) may now require additional searches for the @waitfor@ statement to check if a routine is already queued.
 
 \begin{figure}
-\begin{cfacode}[caption={Example of nested external scheduling},label={lst:nest-ext}]
+\begin{cfa}[caption={Example of nested external scheduling},label={lst:nest-ext}]
 monitor M {};
 void foo( M & mutex a ) {}
 void bar( M & mutex b ) {
-	//Nested in the waitfor(bar, c) call
+	// Nested in the waitfor(bar, c) call
 	waitfor(foo, b);
 }
@@ -1838,5 +1933,5 @@
 }
 
-\end{cfacode}
+\end{cfa}
 \end{figure}
 
@@ -1858,5 +1953,5 @@
 External scheduling, like internal scheduling, becomes significantly more complex when introducing multi-monitor syntax.
 Even in the simplest possible case, some new semantics needs to be established:
-\begin{cfacode}
+\begin{cfa}
 monitor M {};
 
@@ -1864,10 +1959,10 @@
 
 void g(M & mutex b, M & mutex c) {
-	waitfor(f); //two monitors M => unknown which to pass to f(M & mutex)
-}
-\end{cfacode}
+	waitfor(f); // two monitors M => unknown which to pass to f(M & mutex)
+}
+\end{cfa}
 The obvious solution is to specify the correct monitor as follows:
 
-\begin{cfacode}
+\begin{cfa}
 monitor M {};
 
@@ -1875,14 +1970,14 @@
 
 void g(M & mutex a, M & mutex b) {
-	//wait for call to f with argument b
+	// wait for call to f with argument b
 	waitfor(f, b);
 }
-\end{cfacode}
+\end{cfa}
 This syntax is unambiguous.
-Both locks are acquired and kept by \code{g}.
-When routine \code{f} is called, the lock for monitor \code{b} is temporarily transferred from \code{g} to \code{f} (while \code{g} still holds lock \code{a}).
-This behaviour can be extended to the multi-monitor \code{waitfor} statement as follows.
-
-\begin{cfacode}
+Both locks are acquired and kept by @g@.
+When routine @f@ is called, the lock for monitor @b@ is temporarily transferred from @g@ to @f@ (while @g@ still holds lock @a@).
+This behaviour can be extended to the multi-monitor @waitfor@ statement as follows.
+
+\begin{cfa}
 monitor M {};
 
@@ -1890,14 +1985,14 @@
 
 void g(M & mutex a, M & mutex b) {
-	//wait for call to f with arguments a and b
+	// wait for call to f with arguments a and b
 	waitfor(f, a, b);
 }
-\end{cfacode}
-
-Note that the set of monitors passed to the \code{waitfor} statement must be entirely contained in the set of monitors already acquired in the routine. \code{waitfor} used in any other context is undefined behaviour.
+\end{cfa}
+
+Note that the set of monitors passed to the @waitfor@ statement must be entirely contained in the set of monitors already acquired in the routine. @waitfor@ used in any other context is undefined behaviour.
 
 An important behaviour to note is when a set of monitors only match partially:
 
-\begin{cfacode}
+\begin{cfa}
 mutex struct A {};
 
@@ -1912,29 +2007,29 @@
 
 void foo() {
-	g(a1, b); //block on accept
+	g(a1, b); // block on accept
 }
 
 void bar() {
-	f(a2, b); //fulfill cooperation
-}
-\end{cfacode}
+	f(a2, b); // fulfill cooperation
+}
+\end{cfa}
 While the equivalent can happen when using internal scheduling, the fact that conditions are specific to a set of monitors means that users have to use two different condition variables.
 In both cases, partially matching monitor sets does not wakeup the waiting thread.
-It is also important to note that in the case of external scheduling the order of parameters is irrelevant; \code{waitfor(f,a,b)} and \code{waitfor(f,b,a)} are indistinguishable waiting condition.
-
-% ======================================================================
-% ======================================================================
-\subsection{\code{waitfor} Semantics}
-% ======================================================================
-% ======================================================================
-
-Syntactically, the \code{waitfor} statement takes a function identifier and a set of monitors.
-While the set of monitors can be any list of expressions, the function name is more restricted because the compiler validates at compile time the validity of the function type and the parameters used with the \code{waitfor} statement.
+It is also important to note that in the case of external scheduling the order of parameters is irrelevant; @waitfor(f,a,b)@ and @waitfor(f,b,a)@ are indistinguishable waiting condition.
+
+% ======================================================================
+% ======================================================================
+\subsection{\protect\lstinline|waitfor| Semantics}
+% ======================================================================
+% ======================================================================
+
+Syntactically, the @waitfor@ statement takes a function identifier and a set of monitors.
+While the set of monitors can be any list of expressions, the function name is more restricted because the compiler validates at compile time the validity of the function type and the parameters used with the @waitfor@ statement.
 It checks that the set of monitors passed in matches the requirements for a function call.
 Listing \ref{lst:waitfor} shows various usages of the waitfor statement and which are acceptable.
-The choice of the function type is made ignoring any non-\code{mutex} parameter.
+The choice of the function type is made ignoring any non-@mutex@ parameter.
 One limitation of the current implementation is that it does not handle overloading, but overloading is possible.
 \begin{figure}
-\begin{cfacode}[caption={Various correct and incorrect uses of the waitfor statement},label={lst:waitfor}]
+\begin{cfa}[caption={Various correct and incorrect uses of the waitfor statement},label={lst:waitfor}]
 monitor A{};
 monitor B{};
@@ -1950,31 +2045,31 @@
 	void (*fp)( A & mutex ) = f1;
 
-	waitfor(f1, a1);     //Correct : 1 monitor case
-	waitfor(f2, a1, b1); //Correct : 2 monitor case
-	waitfor(f3, a1);     //Correct : non-mutex arguments are ignored
-	waitfor(f1, *ap);    //Correct : expression as argument
-
-	waitfor(f1, a1, b1); //Incorrect : Too many mutex arguments
-	waitfor(f2, a1);     //Incorrect : Too few mutex arguments
-	waitfor(f2, a1, a2); //Incorrect : Mutex arguments don't match
-	waitfor(f1, 1);      //Incorrect : 1 not a mutex argument
-	waitfor(f9, a1);     //Incorrect : f9 function does not exist
-	waitfor(*fp, a1 );   //Incorrect : fp not an identifier
-	waitfor(f4, a1);     //Incorrect : f4 ambiguous
-
-	waitfor(f2, a1, b2); //Undefined behaviour : b2 not mutex
-}
-\end{cfacode}
+	waitfor(f1, a1);     // Correct : 1 monitor case
+	waitfor(f2, a1, b1); // Correct : 2 monitor case
+	waitfor(f3, a1);     // Correct : non-mutex arguments are ignored
+	waitfor(f1, *ap);    // Correct : expression as argument
+
+	waitfor(f1, a1, b1); // Incorrect : Too many mutex arguments
+	waitfor(f2, a1);     // Incorrect : Too few mutex arguments
+	waitfor(f2, a1, a2); // Incorrect : Mutex arguments don't match
+	waitfor(f1, 1);      // Incorrect : 1 not a mutex argument
+	waitfor(f9, a1);     // Incorrect : f9 function does not exist
+	waitfor(*fp, a1 );   // Incorrect : fp not an identifier
+	waitfor(f4, a1);     // Incorrect : f4 ambiguous
+
+	waitfor(f2, a1, b2); // Undefined behaviour : b2 not mutex
+}
+\end{cfa}
 \end{figure}
 
-Finally, for added flexibility, \CFA supports constructing a complex \code{waitfor} statement using the \code{or}, \code{timeout} and \code{else}.
-Indeed, multiple \code{waitfor} clauses can be chained together using \code{or}; this chain forms a single statement that uses baton pass to any function that fits one of the function+monitor set passed in.
-To enable users to tell which accepted function executed, \code{waitfor}s are followed by a statement (including the null statement \code{;}) or a compound statement, which is executed after the clause is triggered.
-A \code{waitfor} chain can also be followed by a \code{timeout}, to signify an upper bound on the wait, or an \code{else}, to signify that the call should be non-blocking, which checks for a matching function call already arrived and otherwise continues.
-Any and all of these clauses can be preceded by a \code{when} condition to dynamically toggle the accept clauses on or off based on some current state.
+Finally, for added flexibility, \CFA supports constructing a complex @waitfor@ statement using the @or@, @timeout@ and @else@.
+Indeed, multiple @waitfor@ clauses can be chained together using @or@; this chain forms a single statement that uses baton pass to any function that fits one of the function+monitor set passed in.
+To enable users to tell which accepted function executed, @waitfor@s are followed by a statement (including the null statement @;@) or a compound statement, which is executed after the clause is triggered.
+A @waitfor@ chain can also be followed by a @timeout@, to signify an upper bound on the wait, or an @else@, to signify that the call should be non-blocking, which checks for a matching function call already arrived and otherwise continues.
+Any and all of these clauses can be preceded by a @when@ condition to dynamically toggle the accept clauses on or off based on some current state.
 Listing \ref{lst:waitfor2} demonstrates several complex masks and some incorrect ones.
 
 \begin{figure}
-\begin{cfacode}[caption={Various correct and incorrect uses of the or, else, and timeout clause around a waitfor statement},label={lst:waitfor2}]
+\begin{cfa}[caption={Various correct and incorrect uses of the or, else, and timeout clause around a waitfor statement},label={lst:waitfor2}]
 monitor A{};
 
@@ -1983,13 +2078,13 @@
 
 void foo( A & mutex a, bool b, int t ) {
-	//Correct : blocking case
+	// Correct : blocking case
 	waitfor(f1, a);
 
-	//Correct : block with statement
+	// Correct : block with statement
 	waitfor(f1, a) {
 		sout | "f1" | endl;
 	}
 
-	//Correct : block waiting for f1 or f2
+	// Correct : block waiting for f1 or f2
 	waitfor(f1, a) {
 		sout | "f1" | endl;
@@ -1998,8 +2093,8 @@
 	}
 
-	//Correct : non-blocking case
+	// Correct : non-blocking case
 	waitfor(f1, a); or else;
 
-	//Correct : non-blocking case
+	// Correct : non-blocking case
 	waitfor(f1, a) {
 		sout | "blocked" | endl;
@@ -2008,5 +2103,5 @@
 	}
 
-	//Correct : block at most 10 seconds
+	// Correct : block at most 10 seconds
 	waitfor(f1, a) {
 		sout | "blocked" | endl;
@@ -2015,23 +2110,23 @@
 	}
 
-	//Correct : block only if b == true
-	//if b == false, don't even make the call
+	// Correct : block only if b == true
+	// if b == false, don't even make the call
 	when(b) waitfor(f1, a);
 
-	//Correct : block only if b == true
-	//if b == false, make non-blocking call
+	// Correct : block only if b == true
+	// if b == false, make non-blocking call
 	waitfor(f1, a); or when(!b) else;
 
-	//Correct : block only of t > 1
+	// Correct : block only of t > 1
 	waitfor(f1, a); or when(t > 1) timeout(t); or else;
 
-	//Incorrect : timeout clause is dead code
+	// Incorrect : timeout clause is dead code
 	waitfor(f1, a); or timeout(t); or else;
 
-	//Incorrect : order must be
-	//waitfor [or waitfor... [or timeout] [or else]]
+	// Incorrect : order must be
+	// waitfor [or waitfor... [or timeout] [or else]]
 	timeout(t); or waitfor(f1, a); or else;
 }
-\end{cfacode}
+\end{cfa}
 \end{figure}
 
@@ -2041,11 +2136,11 @@
 % ======================================================================
 % ======================================================================
-An interesting use for the \code{waitfor} statement is destructor semantics.
-Indeed, the \code{waitfor} statement can accept any \code{mutex} routine, which includes the destructor (see section \ref{data}).
+An interesting use for the @waitfor@ statement is destructor semantics.
+Indeed, the @waitfor@ statement can accept any @mutex@ routine, which includes the destructor (see section \ref{data}).
 However, with the semantics discussed until now, waiting for the destructor does not make any sense, since using an object after its destructor is called is undefined behaviour.
-The simplest approach is to disallow \code{waitfor} on a destructor.
-However, a more expressive approach is to flip ordering of execution when waiting for the destructor, meaning that waiting for the destructor allows the destructor to run after the current \code{mutex} routine, similarly to how a condition is signalled.
+The simplest approach is to disallow @waitfor@ on a destructor.
+However, a more expressive approach is to flip ordering of execution when waiting for the destructor, meaning that waiting for the destructor allows the destructor to run after the current @mutex@ routine, similarly to how a condition is signalled.
 \begin{figure}
-\begin{cfacode}[caption={Example of an executor which executes action in series until the destructor is called.},label={lst:dtor-order}]
+\begin{cfa}[caption={Example of an executor which executes action in series until the destructor is called.},label={lst:dtor-order}]
 monitor Executer {};
 struct  Action;
@@ -2061,5 +2156,5 @@
 	}
 }
-\end{cfacode}
+\end{cfa}
 \end{figure}
 For example, listing \ref{lst:dtor-order} shows an example of an executor with an infinite loop, which waits for the destructor to break out of this loop.
@@ -2079,5 +2174,5 @@
 In this decade, it is no longer reasonable to create a high-performance application without caring about parallelism.
 Indeed, parallelism is an important aspect of performance and more specifically throughput and hardware utilization.
-The lowest-level approach of parallelism is to use \textbf{kthread} in combination with semantics like \code{fork}, \code{join}, etc.
+The lowest-level approach of parallelism is to use \textbf{kthread} in combination with semantics like @fork@, @join@, etc.
 However, since these have significant costs and limitations, \textbf{kthread} are now mostly used as an implementation tool rather than a user oriented one.
 There are several alternatives to solve these issues that all have strengths and weaknesses.
@@ -2158,5 +2253,5 @@
 Conveniently, the call stack fits that description and is easy to use, which is why it is used heavily in the implementation of internal scheduling, particularly variable-length arrays.
 Since stack allocation is based on scopes, the first step of the implementation is to identify the scopes that are available to store the information, and which of these can have a variable-length array.
-The threads and the condition both have a fixed amount of memory, while \code{mutex} routines and blocking calls allow for an unbound amount, within the stack size.
+The threads and the condition both have a fixed amount of memory, while @mutex@ routines and blocking calls allow for an unbound amount, within the stack size.
 
 Note that since the major contributions of this paper are extending monitor semantics to \textbf{bulk-acq} and loose object definitions, any challenges that are not resulting of these characteristics of \CFA are considered as solved problems and therefore not discussed.
@@ -2168,5 +2263,5 @@
 % ======================================================================
 
-The first step towards the monitor implementation is simple \code{mutex} routines.
+The first step towards the monitor implementation is simple @mutex@ routines.
 In the single monitor case, mutual-exclusion is done using the entry/exit procedure in listing \ref{lst:entry1}.
 The entry/exit procedures do not have to be extended to support multiple monitors.
@@ -2179,5 +2274,5 @@
 \begin{multicols}{2}
 Entry
-\begin{pseudo}
+\begin{cfa}
 if monitor is free
 	enter
@@ -2187,16 +2282,16 @@
 	block
 increment recursions
-\end{pseudo}
+\end{cfa}
 \columnbreak
 Exit
-\begin{pseudo}
+\begin{cfa}
 decrement recursion
 if recursion == 0
 	if entry queue not empty
 		wake-up thread
-\end{pseudo}
+\end{cfa}
 \end{multicols}
-\begin{pseudo}[caption={Initial entry and exit routine for monitors},label={lst:entry1}]
-\end{pseudo}
+\begin{cfa}[caption={Initial entry and exit routine for monitors},label={lst:entry1}]
+\end{cfa}
 \end{figure}
 
@@ -2205,6 +2300,6 @@
 However, it is shown that entry-point locking solves most of the issues.
 
-First of all, interaction between \code{otype} polymorphism (see Section~\ref{s:ParametricPolymorphism}) and monitors is impossible since monitors do not support copying.
-Therefore, the main question is how to support \code{dtype} polymorphism.
+First of all, interaction between @otype@ polymorphism (see Section~\ref{s:ParametricPolymorphism}) and monitors is impossible since monitors do not support copying.
+Therefore, the main question is how to support @dtype@ polymorphism.
 It is important to present the difference between the two acquiring options: \textbf{callsite-locking} and entry-point locking, i.e., acquiring the monitors before making a mutex routine-call or as the first operation of the mutex routine-call.
 For example:
@@ -2213,10 +2308,10 @@
 \begin{tabular}{|c|c|c|}
 Mutex & \textbf{callsite-locking} & \textbf{entry-point-locking} \\
-call & pseudo-code & pseudo-code \\
+call & cfa-code & cfa-code \\
 \hline
-\begin{cfacode}[tabsize=3]
+\begin{cfa}[tabsize=3]
 void foo(monitor& mutex a){
 
-	//Do Work
+	// Do Work
 	//...
 
@@ -2229,8 +2324,8 @@
 
 }
-\end{cfacode} & \begin{pseudo}[tabsize=3]
+\end{cfa} & \begin{cfa}[tabsize=3]
 foo(& a) {
 
-	//Do Work
+	// Do Work
 	//...
 
@@ -2243,8 +2338,8 @@
 	release(a);
 }
-\end{pseudo} & \begin{pseudo}[tabsize=3]
+\end{cfa} & \begin{cfa}[tabsize=3]
 foo(& a) {
 	acquire(a);
-	//Do Work
+	// Do Work
 	//...
 	release(a);
@@ -2257,5 +2352,5 @@
 
 }
-\end{pseudo}
+\end{cfa}
 \end{tabular}
 \end{center}
@@ -2264,14 +2359,14 @@
 \end{table}
 
-Note the \code{mutex} keyword relies on the type system, which means that in cases where a generic monitor-routine is desired, writing the mutex routine is possible with the proper trait, e.g.:
-\begin{cfacode}
-//Incorrect: T may not be monitor
+Note the @mutex@ keyword relies on the type system, which means that in cases where a generic monitor-routine is desired, writing the mutex routine is possible with the proper trait, e.g.:
+\begin{cfa}
+// Incorrect: T may not be monitor
 forall(dtype T)
 void foo(T * mutex t);
 
-//Correct: this function only works on monitors (any monitor)
+// Correct: this function only works on monitors (any monitor)
 forall(dtype T | is_monitor(T))
 void bar(T * mutex t));
-\end{cfacode}
+\end{cfa}
 
 Both entry point and \textbf{callsite-locking} are feasible implementations.
@@ -2323,6 +2418,6 @@
 Obviously, this doubles the context-switch cost because threads must context-switch to an intermediate stack.
 The alternative 1-step context-switch uses the stack of the ``from'' thread to schedule and then context-switches directly to the ``to'' thread.
-However, the performance of the 2-step context-switch is still superior to a \code{pthread_yield} (see section \ref{results}).
-Additionally, for users in need for optimal performance, it is important to note that having a 2-step context-switch as the default does not prevent \CFA from offering a 1-step context-switch (akin to the Microsoft \code{SwitchToFiber}~\cite{switchToWindows} routine).
+However, the performance of the 2-step context-switch is still superior to a @pthread_yield@ (see section \ref{results}).
+Additionally, for users in need for optimal performance, it is important to note that having a 2-step context-switch as the default does not prevent \CFA from offering a 1-step context-switch (akin to the Microsoft @SwitchToFiber@~\cite{switchToWindows} routine).
 This option is not currently present in \CFA, but the changes required to add it are strictly additive.
 
@@ -2356,8 +2451,8 @@
 This behaviour is only a problem if all kernel threads, among which a user thread can migrate, differ in terms of signal masks\footnote{Sadly, official POSIX documentation is silent on what distinguishes ``async-signal-safe'' functions from other functions.}.
 However, since the kernel thread handling preemption requires a different signal mask, executing user threads on the kernel-alarm thread can cause deadlocks.
-For this reason, the alarm thread is in a tight loop around a system call to \code{sigwaitinfo}, requiring very little CPU time for preemption.
+For this reason, the alarm thread is in a tight loop around a system call to @sigwaitinfo@, requiring very little CPU time for preemption.
 One final detail about the alarm thread is how to wake it when additional communication is required (e.g., on thread termination).
-This unblocking is also done using {\tt SIGALRM}, but sent through the \code{pthread_sigqueue}.
-Indeed, \code{sigwait} can differentiate signals sent from \code{pthread_sigqueue} from signals sent from alarms or the kernel.
+This unblocking is also done using {\tt SIGALRM}, but sent through the @pthread_sigqueue@.
+Indeed, @sigwait@ can differentiate signals sent from @pthread_sigqueue@ from signals sent from alarms or the kernel.
 
 \subsection{Scheduler}
@@ -2405,5 +2500,5 @@
 \begin{multicols}{2}
 Entry
-\begin{pseudo}
+\begin{cfa}
 if monitor is free
 	enter
@@ -2414,8 +2509,8 @@
 increment recursion
 
-\end{pseudo}
+\end{cfa}
 \columnbreak
 Exit
-\begin{pseudo}
+\begin{cfa}
 decrement recursion
 if recursion == 0
@@ -2427,8 +2522,8 @@
 	if entry queue not empty
 		wake-up thread
-\end{pseudo}
+\end{cfa}
 \end{multicols}
-\begin{pseudo}[caption={Entry and exit routine for monitors with internal scheduling},label={lst:entry2}]
-\end{pseudo}
+\begin{cfa}[caption={Entry and exit routine for monitors with internal scheduling},label={lst:entry2}]
+\end{cfa}
 \end{figure}
 
@@ -2436,5 +2531,5 @@
 Basically, the solution boils down to having a separate data structure for the condition queue and the AS-stack, and unconditionally transferring ownership of the monitors but only unblocking the thread when the last monitor has transferred ownership.
 This solution is deadlock safe as well as preventing any potential barging.
-The data structures used for the AS-stack are reused extensively for external scheduling, but in the case of internal scheduling, the data is allocated using variable-length arrays on the call stack of the \code{wait} and \code{signal_block} routines.
+The data structures used for the AS-stack are reused extensively for external scheduling, but in the case of internal scheduling, the data is allocated using variable-length arrays on the call stack of the @wait@ and @signal_block@ routines.
 
 \begin{figure}[H]
@@ -2448,5 +2543,5 @@
 Figure \ref{fig:structs} shows a high-level representation of these data structures.
 The main idea behind them is that, a thread cannot contain an arbitrary number of intrusive ``next'' pointers for linking onto monitors.
-The \code{condition node} is the data structure that is queued onto a condition variable and, when signalled, the condition queue is popped and each \code{condition criterion} is moved to the AS-stack.
+The @condition node@ is the data structure that is queued onto a condition variable and, when signalled, the condition queue is popped and each @condition criterion@ is moved to the AS-stack.
 Once all the criteria have been popped from their respective AS-stacks, the thread is woken up, which is what is shown in listing \ref{lst:entry2}.
 
@@ -2458,7 +2553,7 @@
 Similarly to internal scheduling, external scheduling for multiple monitors relies on the idea that waiting-thread queues are no longer specific to a single monitor, as mentioned in section \ref{extsched}.
 For internal scheduling, these queues are part of condition variables, which are still unique for a given scheduling operation (i.e., no signal statement uses multiple conditions).
-However, in the case of external scheduling, there is no equivalent object which is associated with \code{waitfor} statements.
+However, in the case of external scheduling, there is no equivalent object which is associated with @waitfor@ statements.
 This absence means the queues holding the waiting threads must be stored inside at least one of the monitors that is acquired.
-These monitors being the only objects that have sufficient lifetime and are available on both sides of the \code{waitfor} statement.
+These monitors being the only objects that have sufficient lifetime and are available on both sides of the @waitfor@ statement.
 This requires an algorithm to choose which monitor holds the relevant queue.
 It is also important that said algorithm be independent of the order in which users list parameters.
@@ -2477,11 +2572,11 @@
 \begin{itemize}
 	\item The threads waiting on the entry queue need to keep track of which routine they are trying to enter, and using which set of monitors.
-The \code{mutex} routine already has all the required information on its stack, so the thread only needs to keep a pointer to that information.
+The @mutex@ routine already has all the required information on its stack, so the thread only needs to keep a pointer to that information.
 	\item The monitors need to keep a mask of acceptable routines.
 This mask contains for each acceptable routine, a routine pointer and an array of monitors to go with it.
 It also needs storage to keep track of which routine was accepted.
 Since this information is not specific to any monitor, the monitors actually contain a pointer to an integer on the stack of the waiting thread.
-Note that if a thread has acquired two monitors but executes a \code{waitfor} with only one monitor as a parameter, setting the mask of acceptable routines to both monitors will not cause any problems since the extra monitor will not change ownership regardless.
-This becomes relevant when \code{when} clauses affect the number of monitors passed to a \code{waitfor} statement.
+Note that if a thread has acquired two monitors but executes a @waitfor@ with only one monitor as a parameter, setting the mask of acceptable routines to both monitors will not cause any problems since the extra monitor will not change ownership regardless.
+This becomes relevant when @when@ clauses affect the number of monitors passed to a @waitfor@ statement.
 	\item The entry/exit routines need to be updated as shown in listing \ref{lst:entry3}.
 \end{itemize}
@@ -2491,11 +2586,11 @@
 This routine is needed because of the storage requirements of the call order inversion.
 Indeed, when waiting for the destructors, storage is needed for the waiting context and the lifetime of said storage needs to outlive the waiting operation it is needed for.
-For regular \code{waitfor} statements, the call stack of the routine itself matches this requirement but it is no longer the case when waiting for the destructor since it is pushed on to the AS-stack for later.
-The \code{waitfor} semantics can then be adjusted correspondingly, as seen in listing \ref{lst:entry-dtor}
+For regular @waitfor@ statements, the call stack of the routine itself matches this requirement but it is no longer the case when waiting for the destructor since it is pushed on to the AS-stack for later.
+The @waitfor@ semantics can then be adjusted correspondingly, as seen in listing \ref{lst:entry-dtor}
 
 \begin{figure}
 \begin{multicols}{2}
 Entry
-\begin{pseudo}
+\begin{cfa}
 if monitor is free
 	enter
@@ -2508,8 +2603,8 @@
 	block
 increment recursion
-\end{pseudo}
+\end{cfa}
 \columnbreak
 Exit
-\begin{pseudo}
+\begin{cfa}
 decrement recursion
 if recursion == 0
@@ -2524,8 +2619,8 @@
 		wake-up thread
 	endif
-\end{pseudo}
+\end{cfa}
 \end{multicols}
-\begin{pseudo}[caption={Entry and exit routine for monitors with internal scheduling and external scheduling},label={lst:entry3}]
-\end{pseudo}
+\begin{cfa}[caption={Entry and exit routine for monitors with internal scheduling and external scheduling},label={lst:entry3}]
+\end{cfa}
 \end{figure}
 
@@ -2533,5 +2628,5 @@
 \begin{multicols}{2}
 Destructor Entry
-\begin{pseudo}
+\begin{cfa}
 if monitor is free
 	enter
@@ -2547,8 +2642,8 @@
 	wait
 increment recursion
-\end{pseudo}
+\end{cfa}
 \columnbreak
 Waitfor
-\begin{pseudo}
+\begin{cfa}
 if matching thread is already there
 	if found destructor
@@ -2570,8 +2665,8 @@
 block
 return
-\end{pseudo}
+\end{cfa}
 \end{multicols}
-\begin{pseudo}[caption={Pseudo code for the \code{waitfor} routine and the \code{mutex} entry routine for destructors},label={lst:entry-dtor}]
-\end{pseudo}
+\begin{cfa}[caption={Pseudo code for the \protect\lstinline|waitfor| routine and the \protect\lstinline|mutex| entry routine for destructors},label={lst:entry-dtor}]
+\end{cfa}
 \end{figure}
 
@@ -2585,8 +2680,8 @@
 
 \section{Threads As Monitors}
-As it was subtly alluded in section \ref{threads}, \code{thread}s in \CFA are in fact monitors, which means that all monitor features are available when using threads.
+As it was subtly alluded in section \ref{threads}, @thread@s in \CFA are in fact monitors, which means that all monitor features are available when using threads.
 For example, here is a very simple two thread pipeline that could be used for a simulator of a game engine:
 \begin{figure}[H]
-\begin{cfacode}[caption={Toy simulator using \code{thread}s and \code{monitor}s.},label={lst:engine-v1}]
+\begin{cfa}[caption={Toy simulator using \protect\lstinline|thread|s and \protect\lstinline|monitor|s.},label={lst:engine-v1}]
 // Visualization declaration
 thread Renderer {} renderer;
@@ -2615,10 +2710,10 @@
 	}
 }
-\end{cfacode}
+\end{cfa}
 \end{figure}
 One of the obvious complaints of the previous code snippet (other than its toy-like simplicity) is that it does not handle exit conditions and just goes on forever.
 Luckily, the monitor semantics can also be used to clearly enforce a shutdown order in a concise manner:
 \begin{figure}[H]
-\begin{cfacode}[caption={Same toy simulator with proper termination condition.},label={lst:engine-v2}]
+\begin{cfa}[caption={Same toy simulator with proper termination condition.},label={lst:engine-v2}]
 // Visualization declaration
 thread Renderer {} renderer;
@@ -2658,5 +2753,5 @@
 // Call destructor for simulator once simulator finishes
 // Call destructor for renderer to signify shutdown
-\end{cfacode}
+\end{cfa}
 \end{figure}
 
@@ -2664,31 +2759,31 @@
 As mentioned in section \ref{preemption}, \CFA uses preemptive threads by default but can use fibers on demand.
 Currently, using fibers is done by adding the following line of code to the program~:
-\begin{cfacode}
+\begin{cfa}
 unsigned int default_preemption() {
 	return 0;
 }
-\end{cfacode}
+\end{cfa}
 This function is called by the kernel to fetch the default preemption rate, where 0 signifies an infinite time-slice, i.e., no preemption.
 However, once clusters are fully implemented, it will be possible to create fibers and \textbf{uthread} in the same system, as in listing \ref{lst:fiber-uthread}
 \begin{figure}
-\begin{cfacode}[caption={Using fibers and \textbf{uthread} side-by-side in \CFA},label={lst:fiber-uthread}]
-//Cluster forward declaration
+\begin{cfa}[caption={Using fibers and \textbf{uthread} side-by-side in \CFA},label={lst:fiber-uthread}]
+// Cluster forward declaration
 struct cluster;
 
-//Processor forward declaration
+// Processor forward declaration
 struct processor;
 
-//Construct clusters with a preemption rate
+// Construct clusters with a preemption rate
 void ?{}(cluster& this, unsigned int rate);
-//Construct processor and add it to cluster
+// Construct processor and add it to cluster
 void ?{}(processor& this, cluster& cluster);
-//Construct thread and schedule it on cluster
+// Construct thread and schedule it on cluster
 void ?{}(thread& this, cluster& cluster);
 
-//Declare two clusters
-cluster thread_cluster = { 10`ms };			//Preempt every 10 ms
-cluster fibers_cluster = { 0 };				//Never preempt
-
-//Construct 4 processors
+// Declare two clusters
+cluster thread_cluster = { 10`ms };			// Preempt every 10 ms
+cluster fibers_cluster = { 0 };				// Never preempt
+
+// Construct 4 processors
 processor processors[4] = {
 	//2 for the thread cluster
@@ -2700,9 +2795,9 @@
 };
 
-//Declares thread
+// Declares thread
 thread UThread {};
 void ?{}(UThread& this) {
-	//Construct underlying thread to automatically
-	//be scheduled on the thread cluster
+	// Construct underlying thread to automatically
+	// be scheduled on the thread cluster
 	(this){ thread_cluster }
 }
@@ -2710,14 +2805,14 @@
 void main(UThread & this);
 
-//Declares fibers
+// Declares fibers
 thread Fiber {};
 void ?{}(Fiber& this) {
-	//Construct underlying thread to automatically
-	//be scheduled on the fiber cluster
+	// Construct underlying thread to automatically
+	// be scheduled on the fiber cluster
 	(this.__thread){ fibers_cluster }
 }
 
 void main(Fiber & this);
-\end{cfacode}
+\end{cfa}
 \end{figure}
 
@@ -2763,7 +2858,7 @@
 
 \section{Micro Benchmarks}
-All benchmarks are run using the same harness to produce the results, seen as the \code{BENCH()} macro in the following examples.
+All benchmarks are run using the same harness to produce the results, seen as the @BENCH()@ macro in the following examples.
 This macro uses the following logic to benchmark the code:
-\begin{pseudo}
+\begin{cfa}
 #define BENCH(run, result) \
 	before = gettime(); \
@@ -2771,6 +2866,6 @@
 	after  = gettime(); \
 	result = (after - before) / N;
-\end{pseudo}
-The method used to get time is \code{clock_gettime(CLOCK_THREAD_CPUTIME_ID);}.
+\end{cfa}
+The method used to get time is @clock_gettime(CLOCK_THREAD_CPUTIME_ID);@.
 Each benchmark is using many iterations of a simple call to measure the cost of the call.
 The specific number of iterations depends on the specific benchmark.
@@ -2787,5 +2882,5 @@
 \begin{multicols}{2}
 \CFA Coroutines
-\begin{cfacode}
+\begin{cfa}
 coroutine GreatSuspender {};
 void main(GreatSuspender& this) {
@@ -2803,8 +2898,8 @@
 	printf("%llu\n", result);
 }
-\end{cfacode}
+\end{cfa}
 \columnbreak
 \CFA Threads
-\begin{cfacode}
+\begin{cfa}
 
 
@@ -2822,8 +2917,8 @@
 	printf("%llu\n", result);
 }
-\end{cfacode}
+\end{cfa}
 \end{multicols}
-\begin{cfacode}[caption={\CFA benchmark code used to measure context-switches for coroutines and threads.},label={lst:ctx-switch}]
-\end{cfacode}
+\begin{cfa}[caption={\CFA benchmark code used to measure context-switches for coroutines and threads.},label={lst:ctx-switch}]
+\end{cfa}
 \end{figure}
 
@@ -2853,9 +2948,9 @@
 For monitors, the simplest approach is to measure how long it takes to enter and leave a monitor routine.
 Listing \ref{lst:mutex} shows the code for \CFA.
-To put the results in context, the cost of entering a non-inline function and the cost of acquiring and releasing a \code{pthread_mutex} lock is also measured.
+To put the results in context, the cost of entering a non-inline function and the cost of acquiring and releasing a @pthread_mutex@ lock is also measured.
 The results can be shown in table \ref{tab:mutex}.
 
 \begin{figure}
-\begin{cfacode}[caption={\CFA benchmark code used to measure mutex routines.},label={lst:mutex}]
+\begin{cfa}[caption={\CFA benchmark code used to measure mutex routines.},label={lst:mutex}]
 monitor M {};
 void __attribute__((noinline)) call( M & mutex m /*, m2, m3, m4*/ ) {}
@@ -2871,5 +2966,5 @@
 	printf("%llu\n", result);
 }
-\end{cfacode}
+\end{cfa}
 \end{figure}
 
@@ -2883,8 +2978,8 @@
 FetchAdd + FetchSub				& 26		& 26		& 0    \\
 Pthreads Mutex Lock				& 31		& 31.86	& 0.99 \\
-\uC \code{monitor} member routine		& 30		& 30		& 0    \\
-\CFA \code{mutex} routine, 1 argument	& 41		& 41.57	& 0.9  \\
-\CFA \code{mutex} routine, 2 argument	& 76		& 76.96	& 1.57 \\
-\CFA \code{mutex} routine, 4 argument	& 145		& 146.68	& 3.85 \\
+\uC @monitor@ member routine		& 30		& 30		& 0    \\
+\CFA @mutex@ routine, 1 argument	& 41		& 41.57	& 0.9  \\
+\CFA @mutex@ routine, 2 argument	& 76		& 76.96	& 1.57 \\
+\CFA @mutex@ routine, 4 argument	& 145		& 146.68	& 3.85 \\
 Java synchronized routine			& 27		& 28.57	& 2.6  \\
 \hline
@@ -2902,5 +2997,5 @@
 
 \begin{figure}
-\begin{cfacode}[caption={Benchmark code for internal scheduling},label={lst:int-sched}]
+\begin{cfa}[caption={Benchmark code for internal scheduling},label={lst:int-sched}]
 volatile int go = 0;
 condition c;
@@ -2932,5 +3027,5 @@
 	return do_wait(m1);
 }
-\end{cfacode}
+\end{cfa}
 \end{figure}
 
@@ -2942,9 +3037,9 @@
 \hline
 Pthreads Condition Variable			& 5902.5	& 6093.29 	& 714.78 \\
-\uC \code{signal}					& 322		& 323 	& 3.36   \\
-\CFA \code{signal}, 1 \code{monitor}	& 352.5	& 353.11	& 3.66   \\
-\CFA \code{signal}, 2 \code{monitor}	& 430		& 430.29	& 8.97   \\
-\CFA \code{signal}, 4 \code{monitor}	& 594.5	& 606.57	& 18.33  \\
-Java \code{notify}				& 13831.5	& 15698.21	& 4782.3 \\
+\uC @signal@					& 322		& 323 	& 3.36   \\
+\CFA @signal@, 1 @monitor@	& 352.5	& 353.11	& 3.66   \\
+\CFA @signal@, 2 @monitor@	& 430		& 430.29	& 8.97   \\
+\CFA @signal@, 4 @monitor@	& 594.5	& 606.57	& 18.33  \\
+Java @notify@				& 13831.5	& 15698.21	& 4782.3 \\
 \hline
 \end{tabular}
@@ -2956,10 +3051,10 @@
 
 \subsection{External Scheduling}
-The Internal scheduling benchmark measures the cost of the \code{waitfor} statement (\code{_Accept} in \uC).
+The Internal scheduling benchmark measures the cost of the @waitfor@ statement (@_Accept@ in \uC).
 Listing \ref{lst:ext-sched} shows the code for \CFA, with results in table \ref{tab:ext-sched}.
 As with all other benchmarks, all omitted tests are functionally identical to one of these tests.
 
 \begin{figure}
-\begin{cfacode}[caption={Benchmark code for external scheduling},label={lst:ext-sched}]
+\begin{cfa}[caption={Benchmark code for external scheduling},label={lst:ext-sched}]
 volatile int go = 0;
 monitor M {};
@@ -2990,5 +3085,5 @@
 	return do_wait(m1);
 }
-\end{cfacode}
+\end{cfa}
 \end{figure}
 
@@ -2999,8 +3094,8 @@
 \multicolumn{1}{c |}{} & \multicolumn{1}{c |}{ Median } &\multicolumn{1}{c |}{ Average } & \multicolumn{1}{c |}{ Standard Deviation} \\
 \hline
-\uC \code{Accept}					& 350		& 350.61	& 3.11  \\
-\CFA \code{waitfor}, 1 \code{monitor}	& 358.5	& 358.36	& 3.82  \\
-\CFA \code{waitfor}, 2 \code{monitor}	& 422		& 426.79	& 7.95  \\
-\CFA \code{waitfor}, 4 \code{monitor}	& 579.5	& 585.46	& 11.25 \\
+\uC @Accept@					& 350		& 350.61	& 3.11  \\
+\CFA @waitfor@, 1 @monitor@	& 358.5	& 358.36	& 3.82  \\
+\CFA @waitfor@, 2 @monitor@	& 422		& 426.79	& 7.95  \\
+\CFA @waitfor@, 4 @monitor@	& 579.5	& 585.46	& 11.25 \\
 \hline
 \end{tabular}
@@ -3020,5 +3115,5 @@
 \begin{center}
 \texttt{pthread}
-\begin{ccode}
+\begin{cfa}
 int main() {
 	BENCH(
@@ -3039,10 +3134,10 @@
 	printf("%llu\n", result);
 }
-\end{ccode}
+\end{cfa}
 
 
 
 \CFA Threads
-\begin{cfacode}
+\begin{cfa}
 int main() {
 	BENCH(
@@ -3054,8 +3149,8 @@
 	printf("%llu\n", result);
 }
-\end{cfacode}
+\end{cfa}
 \end{center}
-\begin{cfacode}[caption={Benchmark code for \texttt{pthread}s and \CFA to measure object creation},label={lst:creation}]
-\end{cfacode}
+\begin{cfa}[caption={Benchmark code for \texttt{pthread}s and \CFA to measure object creation},label={lst:creation}]
+\end{cfa}
 \end{figure}
 
@@ -3141,5 +3236,5 @@
 \begin{tabular}[t]{|c|c|c|}
 Sequential & Library Parallel & Language Parallel \\
-\begin{cfacode}[tabsize=3]
+\begin{cfa}[tabsize=3]
 void big_sum(
 	int* a, int* b,
@@ -3165,5 +3260,5 @@
 //... fill in a & b
 big_sum(a,b,c,10000);
-\end{cfacode} &\begin{cfacode}[tabsize=3]
+\end{cfa} &\begin{cfa}[tabsize=3]
 void big_sum(
 	int* a, int* b,
@@ -3189,5 +3284,5 @@
 //... fill in a & b
 big_sum(a,b,c,10000);
-\end{cfacode}&\begin{cfacode}[tabsize=3]
+\end{cfa}&\begin{cfa}[tabsize=3]
 void big_sum(
 	int* a, int* b,
@@ -3213,5 +3308,5 @@
 //... fill in a & b
 big_sum(a,b,c,10000);
-\end{cfacode}
+\end{cfa}
 \end{tabular}
 \end{center}
Index: doc/papers/concurrency/annex/local.bib
===================================================================
--- doc/papers/concurrency/annex/local.bib	(revision 41624f920cc089ca5cfd4d561c8971bc2c474125)
+++ doc/papers/concurrency/annex/local.bib	(revision aac71977640c99334881f777535dfd1070e0a264)
@@ -21,9 +21,15 @@
 @string{pldi="Programming Language Design and Implementation"}
 
-
-@article{HPP:Study,
-	keywords 	= {Parallel, Productivity},
-	author 	= {Lorin Hochstein and Jeff Carver and Forrest Shull and Sima Asgari and Victor Basili and Jeffrey K. Hollingsworth and Marvin V. Zelkowitz },
-	title 	= {Parallel Programmer Productivity: A Case Study of Novice Parallel Programmers},
+@inproceedings{Hochstein05,
+    keywords	= {Application software; Computer aided software engineering; Concurrent computing; Educational
+                  institutions; High performance computing; Humans; Instruments; Productivity; Programming profession;
+                  Software engineering},
+    author	= {Lorin Hochstein and Jeff Carver and Forrest Shull and Sima Asgari and Victor Basili and Jeffrey K. Hollingsworth and Marvin V. Zelkowitz},
+    title	= {Parallel Programmer Productivity: A Case Study of Novice Parallel Programmers},
+    booktitle	= {Supercomputing, 2005. Proceedings of the ACM/IEEE SC 2005 Conference},
+    publisher	= {IEEE},
+    year	= {2005},
+    pages	= {35-35},
+    month	= nov,
 }
 
@@ -35,9 +41,10 @@
 }
 
-@article{TBB,
-	key	= {TBB},
-	keywords 	= {Intel, TBB},
-	title 	= {Intel Thread Building Blocks},
-	note		= "\url{https://www.threadingbuildingblocks.org/}"
+@misc{TBB,
+    keywords 	= {Intel, TBB},
+    key		= {TBB},
+    title 	= {Thread Building Blocks},
+    howpublished= {Intel, \url{https://www.threadingbuildingblocks.org}},
+    note	= {Accessed: 2018-3},
 }
 
@@ -48,13 +55,4 @@
 	title 	= {C$\forall$ Programmming Language},
 	note	= {\url{https://plg.uwaterloo.ca/~cforall}},
-}
-
-@mastersthesis{rob-thesis,
-	keywords 	= {Constructors, Destructors, Tuples},
-	author	= {Rob Schluntz},
-	title 	= {Resource Management and Tuples in Cforall},
-	year		= 2017,
-	school	= {University of Waterloo},
-	note	= {\url{https://uwspace.uwaterloo.ca/handle/10012/11830}},
 }
 
Index: doc/papers/concurrency/style/cfa-format.tex
===================================================================
--- doc/papers/concurrency/style/cfa-format.tex	(revision 41624f920cc089ca5cfd4d561c8971bc2c474125)
+++ doc/papers/concurrency/style/cfa-format.tex	(revision aac71977640c99334881f777535dfd1070e0a264)
@@ -11,164 +11,161 @@
 % from https://gist.github.com/nikolajquorning/92bbbeef32e1dd80105c9bf2daceb89a
 \lstdefinelanguage{sml} {
-  morekeywords= {
-    EQUAL, GREATER, LESS, NONE, SOME, abstraction, abstype, and, andalso, array, as, before, bool, case, char, datatype, do, else, end, eqtype, exception, exn, false, fn, fun, functor, handle, if, in, include, infix, infixr, int, let, list, local, nil, nonfix, not, o, of, op, open, option, orelse, overload, print, raise, real, rec, ref, sharing, sig, signature, string, struct, structure, substring, then, true, type, unit, val, vector, where, while, with, withtype, word
-  },
-  morestring=[b]",
-  morecomment=[s]{(*}{*)},
+	morekeywords= {
+		EQUAL, GREATER, LESS, NONE, SOME, abstraction, abstype, and, andalso, array, as, before,
+		bool, case, char, datatype, do, else, end, eqtype, exception, exn, false, fn, fun, functor,
+		handle, if, in, include, infix, infixr, int, let, list, local, nil, nonfix, not, o, of, op,
+		open, option, orelse, overload, print, raise, real, rec, ref, sharing, sig, signature,
+		string, struct, structure, substring, then, true, type, unit, val, vector, where, while,
+		with, withtype, word
+    },
+    morestring=[b]",
+    morecomment=[s]{(*}{*)},
 }
 
 \lstdefinelanguage{D}{
-  % Keywords
-  morekeywords=[1]{
-    abstract, alias, align, auto, body, break, cast, catch, class, const,
-    continue, debug, delegate, delete, deprecated, do, else, enum, export,
-    false, final, finally, for, foreach, foreach_reverse, function, goto, if,
-    immutable, import, in, inout, interface, invariant, is, lazy, macro, mixin,
-    module, new, nothrow, null, out, override, package, pragma, private,
-    protected, public, pure, ref, return, shared, static, struct, super,
-    switch, synchronized, template, this, throw, true, try, typedef, typeid,
-    typeof, union, unittest, volatile, while, with
-  },
-  % Special identifiers, common functions
-  morekeywords=[2]{enforce},
-  % Ugly identifiers
-  morekeywords=[3]{
-    __DATE__, __EOF__, __FILE__, __LINE__, __TIMESTAMP__, __TIME__, __VENDOR__,
-    __VERSION__, __ctfe, __gshared, __monitor, __thread, __vptr, _argptr,
-    _arguments, _ctor, _dtor
-  },
-  % Basic types
-  morekeywords=[4]{
-     byte, ubyte, short, ushort, int, uint, long, ulong, cent, ucent, void,
-     bool, bit, float, double, real, ushort, int, uint, long, ulong, float,
-     char, wchar, dchar, string, wstring, dstring, ireal, ifloat, idouble,
-     creal, cfloat, cdouble, size_t, ptrdiff_t, sizediff_t, equals_t, hash_t
-  },
-  % Strings
-  morestring=[b]{"},
-  morestring=[b]{'},
-  morestring=[b]{`},
-  % Comments
-  comment=[l]{//},
-  morecomment=[s]{/*}{*/},
-  morecomment=[s][\color{blue}]{/**}{*/},
-  morecomment=[n]{/+}{+/},
-  morecomment=[n][\color{blue}]{/++}{+/},
-  % Options
-  sensitive=true
+	% Keywords
+	morekeywords=[1]{
+		abstract, alias, align, auto, body, break, cast, catch, class, const, continue, debug,
+		delegate, delete, deprecated, do, else, enum, export, false, final, finally, for, foreach,
+		foreach_reverse, function, goto, if, immutable, import, in, inout, interface, invariant, is,
+		lazy, macro, mixin, module, new, nothrow, null, out, override, package, pragma, private,
+		protected, public, pure, ref, return, shared, static, struct, super, switch, synchronized,
+		template, this, throw, true, try, typedef, typeid, typeof, union, unittest, volatile, while,
+		with
+	},
+	% Special identifiers, common functions
+	morekeywords=[2]{enforce},
+	% Ugly identifiers
+	morekeywords=[3]{
+		__DATE__, __EOF__, __FILE__, __LINE__, __TIMESTAMP__, __TIME__, __VENDOR__,
+		__VERSION__, __ctfe, __gshared, __monitor, __thread, __vptr, _argptr,
+		_arguments, _ctor, _dtor
+	},
+	% Basic types
+	morekeywords=[4]{
+		byte, ubyte, short, ushort, int, uint, long, ulong, cent, ucent, void, bool, bit, float,
+		double, real, ushort, int, uint, long, ulong, float, char, wchar, dchar, string, wstring,
+		dstring, ireal, ifloat, idouble, creal, cfloat, cdouble, size_t, ptrdiff_t, sizediff_t,
+		equals_t, hash_t
+	},
+	% Strings
+	morestring=[b]{"},
+	morestring=[b]{'},
+	morestring=[b]{`},
+	% Comments
+	comment=[l]{//},
+	morecomment=[s]{/*}{*/},
+	morecomment=[s][\color{blue}]{/**}{*/},
+	morecomment=[n]{/+}{+/},
+	morecomment=[n][\color{blue}]{/++}{+/},
+	% Options
+	sensitive=true
 }
 
 \lstdefinelanguage{rust}{
-  % Keywords
-  morekeywords=[1]{
-    abstract, alignof, as, become, box,
-    break, const, continue, crate, do,
-    else, enum, extern, false, final,
-    fn, for, if, impl, in,
-    let, loop, macro, match, mod,
-    move, mut, offsetof, override, priv,
-    proc, pub, pure, ref, return,
-    Self, self, sizeof, static, struct,
-    super, trait, true,  type, typeof,
-    unsafe, unsized, use, virtual, where,
-    while, yield
-  },
-  % Strings
-  morestring=[b]{"},
-  % Comments
-  comment=[l]{//},
-  morecomment=[s]{/*}{*/},
-  % Options
-  sensitive=true
+	% Keywords
+	morekeywords=[1]{
+		abstract, alignof, as, become, box, break, const, continue, crate, do, else, enum, extern,
+		false, final, fn, for, if, impl, in, let, loop, macro, match, mod, move, mut, offsetof,
+		override, priv, proc, pub, pure, ref, return, Self, self, sizeof, static, struct, super,
+		trait, true, type, typeof, unsafe, unsized, use, virtual, where, while, yield
+	},
+	% Strings
+	morestring=[b]{"},
+	% Comments
+	comment=[l]{//},
+	morecomment=[s]{/*}{*/},
+	% Options
+	sensitive=true
 }
 
 \lstdefinelanguage{pseudo}{
-	morekeywords={string,uint,int,bool,float},%
-	sensitive=true,%
-	morecomment=[l]{//},%
-	morecomment=[s]{/*}{*/},%
-	morestring=[b]',%
-	morestring=[b]",%
-	morestring=[s]{`}{`},%
-}%
+	morekeywords={string,uint,int,bool,float},
+	sensitive=true,
+	morecomment=[l]{//},
+	morecomment=[s]{/*}{*/},
+	morestring=[b]',
+	morestring=[b]",
+	morestring=[s]{`}{`},
+}
 
 \newcommand{\KWC}{K-W C\xspace}
 
 \lstdefinestyle{pseudoStyle}{
-  escapeinside={@@},
-  basicstyle=\linespread{0.9}\sf\footnotesize,		% reduce line spacing and use typewriter font
-  keywordstyle=\bfseries\color{blue},
-  keywordstyle=[2]\bfseries\color{Plum},
-  commentstyle=\itshape\color{OliveGreen},		    % green and italic comments
-  identifierstyle=\color{identifierCol},
-  stringstyle=\sf\color{Mahogany},			          % use sanserif font
-  mathescape=true,
-  columns=fixed,
-  aboveskip=4pt,                                  % spacing above/below code block
-  belowskip=3pt,
-  keepspaces=true,
-  tabsize=4,
-  % frame=lines,
-  literate=,
-  showlines=true,                                 % show blank lines at end of code
-  showspaces=false,
-  showstringspaces=false,
-  escapechar=\$,
-  xleftmargin=\parindentlnth,                     % indent code to paragraph indentation
-  moredelim=[is][\color{red}\bfseries]{**R**}{**R**},    % red highlighting
-  % moredelim=* detects keywords, comments, strings, and other delimiters and applies their formatting
-  % moredelim=** allows cumulative application
+	escapeinside={@@},
+	basicstyle=\linespread{0.9}\sf\footnotesize,		% reduce line spacing and use typewriter font
+	keywordstyle=\bfseries\color{blue},
+	keywordstyle=[2]\bfseries\color{Plum},
+	commentstyle=\itshape\color{OliveGreen},		    % green and italic comments
+	identifierstyle=\color{identifierCol},
+	stringstyle=\sf\color{Mahogany},					  % use sanserif font
+	mathescape=true,
+	columns=fixed,
+	aboveskip=4pt,								  % spacing above/below code block
+	belowskip=3pt,
+	keepspaces=true,
+	tabsize=4,
+	% frame=lines,
+	literate=,
+	showlines=true,								 % show blank lines at end of code
+	showspaces=false,
+	showstringspaces=false,
+	escapechar=\$,
+	xleftmargin=\parindentlnth,				     % indent code to paragraph indentation
+	moredelim=[is][\color{red}\bfseries]{**R**}{**R**},    % red highlighting
+	% moredelim=* detects keywords, comments, strings, and other delimiters and applies their formatting
+	% moredelim=** allows cumulative application
 }
 
 \lstdefinestyle{defaultStyle}{
-  escapeinside={@@},
-  basicstyle=\linespread{0.9}\tt\footnotesize,		% reduce line spacing and use typewriter font
-  keywordstyle=\bfseries\color{blue},
-  keywordstyle=[2]\bfseries\color{Plum},
-  commentstyle=\itshape\color{OliveGreen},		    % green and italic comments
-  identifierstyle=\color{identifierCol},
-  stringstyle=\sf\color{Mahogany},			          % use sanserif font
-  mathescape=true,
-  columns=fixed,
-  aboveskip=4pt,                                  % spacing above/below code block
-  belowskip=3pt,
-  keepspaces=true,
-  tabsize=4,
-  % frame=lines,
-  literate=,
-  showlines=true,                                 % show blank lines at end of code
-  showspaces=false,
-  showstringspaces=false,
-  escapechar=\$,
-  xleftmargin=\parindentlnth,                     % indent code to paragraph indentation
-  moredelim=[is][\color{red}\bfseries]{**R**}{**R**},    % red highlighting
-  % moredelim=* detects keywords, comments, strings, and other delimiters and applies their formatting
-  % moredelim=** allows cumulative application
+	escapeinside={@@},
+	basicstyle=\linespread{0.9}\tt\footnotesize,		% reduce line spacing and use typewriter font
+	keywordstyle=\bfseries\color{blue},
+	keywordstyle=[2]\bfseries\color{Plum},
+	commentstyle=\itshape\color{OliveGreen},		    % green and italic comments
+	identifierstyle=\color{identifierCol},
+	stringstyle=\sf\color{Mahogany},					  % use sanserif font
+	mathescape=true,
+	columns=fixed,
+	aboveskip=4pt,								  % spacing above/below code block
+	belowskip=3pt,
+	keepspaces=true,
+	tabsize=4,
+	% frame=lines,
+	literate=,
+	showlines=true,								 % show blank lines at end of code
+	showspaces=false,
+	showstringspaces=false,
+	escapechar=\$,
+	xleftmargin=\parindentlnth,				     % indent code to paragraph indentation
+	moredelim=[is][\color{red}\bfseries]{**R**}{**R**},    % red highlighting
+	% moredelim=* detects keywords, comments, strings, and other delimiters and applies their formatting
+	% moredelim=** allows cumulative application
 }
 
 \lstdefinestyle{cfaStyle}{
-  escapeinside={@@},
-  basicstyle=\linespread{0.9}\sf,		% reduce line spacing and use typewriter font
+	escapeinside={@@},
+	basicstyle=\linespread{0.9}\sf,		% reduce line spacing and use typewriter font
 %  keywordstyle=\bfseries\color{blue},
-  keywordstyle=[2]\bfseries\color{red},
+	keywordstyle=[2]\bfseries\color{red},
 %  commentstyle=\sf\itshape\color{OliveGreen},		  % green and italic comments
-  identifierstyle=\color{identifierCol},
-%  stringstyle=\sf\color{Mahogany},			          % use sanserif font
-  stringstyle=\tt,										% use typewriter font
-  mathescape=true,
-  columns=fixed,
-  aboveskip=4pt,                                  % spacing above/below code block
-  belowskip=3pt,
-  keepspaces=true,
-  tabsize=4,
-  % frame=lines,
-  literate=,
-  showlines=true,                                 % show blank lines at end of code
-  showspaces=false,
-  showstringspaces=false,
-  escapechar=\$,
-  xleftmargin=\parindentlnth,                     % indent code to paragraph indentation
-  moredelim=[is][\color{red}\bfseries]{**R**}{**R**},    % red highlighting
-  morekeywords=[2]{accept, signal, signal_block, wait, waitfor},
+	identifierstyle=\color{identifierCol},
+%  stringstyle=\sf\color{Mahogany},					  % use sanserif font
+	stringstyle=\tt,										% use typewriter font
+	mathescape=true,
+	columns=fixed,
+	aboveskip=4pt,								  % spacing above/below code block
+	belowskip=3pt,
+	keepspaces=true,
+	tabsize=4,
+	% frame=lines,
+	literate=,
+	showlines=true,								 % show blank lines at end of code
+	showspaces=false,
+	showstringspaces=false,
+	escapechar=\$,
+	xleftmargin=\parindentlnth,				     % indent code to paragraph indentation
+	moredelim=[is][\color{red}\bfseries]{**R**}{**R**},    % red highlighting
+	morekeywords=[2]{accept, signal, signal_block, wait, waitfor},
 }
 
@@ -176,100 +173,100 @@
 
 \lstnewenvironment{ccode}[1][]{
-  \lstset{
-    language = C,
-    style=defaultStyle,
-    captionpos=b,
-    #1
-  }
+	\lstset{
+		language = C,
+		style=defaultStyle,
+		captionpos=b,
+		#1
+	}
 }{}
 
 \lstnewenvironment{cfacode}[1][]{
-  \lstset{
-    language = CFA,
-    style=cfaStyle,
-    captionpos=b,
-    #1
-  }
+	\lstset{
+		language = CFA,
+		style=cfaStyle,
+		captionpos=b,
+		#1
+	}
 }{}
 
 \lstnewenvironment{pseudo}[1][]{
-  \lstset{
-    language = pseudo,
-    style=pseudoStyle,
-    captionpos=b,
-    #1
-  }
+	\lstset{
+		language = pseudo,
+		style=pseudoStyle,
+		captionpos=b,
+		#1
+	}
 }{}
 
 \lstnewenvironment{cppcode}[1][]{
-  \lstset{
-    language = c++,
-    style=defaultStyle,
-    captionpos=b,
-    #1
-  }
+	\lstset{
+		language = c++,
+		style=defaultStyle,
+		captionpos=b,
+		#1
+	}
 }{}
 
 \lstnewenvironment{ucppcode}[1][]{
-  \lstset{
-    language = c++,
-    style=defaultStyle,
-    captionpos=b,
-    #1
-  }
+	\lstset{
+		language = c++,
+		style=defaultStyle,
+		captionpos=b,
+		#1
+	}
 }{}
 
 \lstnewenvironment{javacode}[1][]{
-  \lstset{
-    language = java,
-    style=defaultStyle,
-    captionpos=b,
-    #1
-  }
+	\lstset{
+		language = java,
+		style=defaultStyle,
+		captionpos=b,
+		#1
+	}
 }{}
 
 \lstnewenvironment{scalacode}[1][]{
-  \lstset{
-    language = scala,
-    style=defaultStyle,
-    captionpos=b,
-    #1
-  }
+	\lstset{
+		language = scala,
+		style=defaultStyle,
+		captionpos=b,
+		#1
+	}
 }{}
 
 \lstnewenvironment{smlcode}[1][]{
-  \lstset{
-    language = sml,
-    style=defaultStyle,
-    captionpos=b,
-    #1
-  }
+	\lstset{
+		language = sml,
+		style=defaultStyle,
+		captionpos=b,
+		#1
+	}
 }{}
 
 \lstnewenvironment{dcode}[1][]{
-  \lstset{
-    language = D,
-    style=defaultStyle,
-    captionpos=b,
-    #1
-  }
+	\lstset{
+		language = D,
+		style=defaultStyle,
+		captionpos=b,
+		#1
+	}
 }{}
 
 \lstnewenvironment{rustcode}[1][]{
-  \lstset{
-    language = rust,
-    style=defaultStyle,
-    captionpos=b,
-    #1
-  }
+	\lstset{
+		language = rust,
+		style=defaultStyle,
+		captionpos=b,
+		#1
+	}
 }{}
 
 \lstnewenvironment{gocode}[1][]{
-  \lstset{
-    language = Golang,
-    style=defaultStyle,
-    captionpos=b,
-    #1
-  }
+	\lstset{
+		language = Golang,
+		style=defaultStyle,
+		captionpos=b,
+		#1
+	}
 }{}
 
@@ -279,2 +276,7 @@
 \newcommand{\code}[1]{\lstinline[language=CFA,style=cfaStyle]{#1}}
 \newcommand{\pscode}[1]{\lstinline[language=pseudo,style=pseudoStyle]{#1}}
+
+% Local Variables: %
+% tab-width: 4 %
+% fill-column: 100 %
+% End: %
