Updated demonstration system to use JSON formatted templates, some code cleanup