Simplified code to make the demo clearer