Merged scopatz PR #21 improvements
Merged scopatz PR #20 improvements datastructures
Merged scopatz PR #18 improvements vars