Extend ValueStack API, add tests
Another round of improvements to error reporting, among other things fixes #37