Refactor some demo code.