Add more error handling