much simpler demoserver, demo and test refactored to remove code duplication