cleanup and refactoring of dsl, add basic tests