I think I may have gone at least some of the way to fixing #233

I'm new to the web/JS development world, and I took this on to try and look through a large codebase, I was just wondering whether this is what you were looking for with issue #233, and whether anyone could look through this and see if I've missed anything.