Added more intelligent error messages