make this work within new scope regime
mutable dictionaries for better compiling, and other minor fixes