Added preliminary function support to new JS DSL.
Continued improvements to dsl2