Refactoring, beginning clean-up

This is still a hellish mess, and doesn't have the same comportment as
the original when trying it out on the playground.

The first priority is finding out what's wrong, then additional
clean-ups and completely removing the jQuery dependency (no more plugin
obligation)