Improving error messages and testing