Add proper error messages and exception handling