Merge pull request #4 from ramatevish/add_atexit

Write to cache now handled by atexit, fixed style, add util.py
Merge branch 'add_atexit'
Merge pull request #6 from ramatevish/master

Merge in add_atexit