Error-checked javascript. Nothing major. Fixes #19.