diff --git a/kral.k b/kral.k
index b37ad7e697b686066f5888c25926b037e809117b..9e4a4e6f50bd92f149ccb226a4a0b893da9e35c2 100755
--- a/kral.k
+++ b/kral.k
@@ -64,23 +64,17 @@ i:&{`i=*x}'cx
 
 p[ca[i]]:{cs:"|||"\p[ca[x]];cs[1+2*!_0.5*#cs]:str'1_cr[x];,//cs}'i
 
-/f:{,//put[p[x][{x+!3+y-x}.y]\p[x];0;z]}
-/f.'ca[i[1]],'(,'*1_cx[i[1]]),','str'1_cr[i[1]]
+p[ca[b]]:(#b)#,("```K source code";"```")
+ib:{put[y;(|/'ca[b])[x];"\r\n```K output\r\n",|"```\n\r",|"\r\n"/str'1_cr[b[x]]]}
 
-/TODO: slot blocks back into text
+p:{$[0=#x;y;0<#x;o[1_x;ib[*x;y]]]}[|!#b;p]
+
+/TODO: add some kind of indicator and indent for the output lines
 /TODO: remove extra \ns from error messages
+/TODO: generally tidy up the newlines mess
 /TODO: add a directive to execute but not display a code block
-
 /TODO: what about duplicate variable names in source code?  may need to prefix vars with e.g. _kral_
-
-/cr:{$[`b=*x;`b,e'p[*|x];`i=*x;`i,"foo"]}'cx
-
-/ce:{$[2=#x;{p[1_x+!y-x]}.x;1=#x;{3_'ss[;p[x]]'cl[x]}[x]]}'ca
-/cr:str''{.[.:;,x;"Err: ",]}''ce
-/il:{3_'ss[;p[x]]'cl[x]}'ci
-
 /TODO: handle line breaks within inline code?
-
 /TODO: make this an SCGI process and IPC calls
 
 /ci:{(*x)+1_!-/|x}'cb
@@ -95,3 +89,4 @@ /p:out[p;-1+&{"::> "~x[!4]}'p;(#&{"::> "~x[!4]}'p)#,"```K output"]
 /p:out[p;&{x~"```K output"}'p;(#&{x~"```K output"}'p)#""]
 
 /w[{x,"\r"}'[p]]
+w["\r\n"/p]
