Reorganize code and add bookmarklet generation code.