fixup style and missing code from the original demo