Fixed #3
Fixed #6

Also moved bootstrap code outside demo.js so it won't slow down the
initial render.