reformat demo code