demo update, small optimizations