Lots of fixes and optimizations for the demo