bugfixes, preliminary DAG-tests work. needs cleanup