improved the demo controller