Better fix for bug 528
Reduce compiler dependencies on substitutions.h,
Some new functionality in substitutions.h/cpp