Add settings for `idfile` and `statefile` - #41

This is #41 rebased on top of the latest master.