Added more validation, fixed more error messages.