more work on parsers/types, more tests, some general tidying