reformatted demo code