Start improving error handling
Hacked together what should be more accurate error logging