Rewrite theme() and lstheme() to remove side effects, add debugging, and fix `local` inside theme definitions. Add `theme next` for stepping through theme list, and "blacklist" support. Modify tools/theme_chooser to use new theme functions.