Proper error handling