Cleans up and documents all the metaprogramming functions
Fixes two small problems in the dsl code