d
added smarter error messages