Added additional error messages, better error handling