clean up demo file

tidy up comments and line spacing
minor fixes

fixed syntax error and variable name typo, also issue with output not
getting <pre> tag.