Adding error handling
Cleanup