Various improvements

- nicer error messages
- TH should work again
- runner code cleanup
- additional tests