Modularize katelibby

Just a bunch of small changes to allow making self-contained JS files for katelibby commands.