Adding better error reporting