Some cleanup
Debugging error handling