Tracking modified state for files

Fixes #2