Adding more verbose error handling