More tests and some small improvements.