Better error messages and function name