Improve io error handling
Cosmesis

Use more idioms and switch to single quotes
Better formatting