Still far from finished with this, but I rewrote a lot of yesterday's code using object-oriented JavaScript. The output is basically the same, but the code looks really different now!