Going to try refactoring the code.
I know it doesn't help that my experience with javascript is nil, but this is proving to be a royal PITA.
Been reading through Javascript: The Good Parts by Crockford. I think I've got a good enough understanding of common paradigms to start meaningfully analyzing the codebase.