Refactor ui.js to explicitly use prototypes.
Refactor gfx.js to explicitly use prototypes.