Modifications to write back to sqlite db