Update filePersist.js

Changes that gh546 has made to the filePersist.js file. 

Restructured and edited with comments