Abandoned JQuery ambitions for now, but fixed a variable access bug.