Refactored code in mpfs.js