improvements to spellbook and some general fixes