[wip] About halfway through translating JS to CS.