Better error messages, more tests