return more helpful error messages
a few cleanups