Some minor refactoring following the demo