Also consider doing this entirely in JS for consistency's sake.