more Reference implementation, cleaned up DSL templates