added better error handling