Factor out setTimeout, fix type error

The `update` function had an extra `function () { ... }` wrapper which I've removed.

Very cool demo :+1: