refactored out some duplicate code in the file plugin
corrected todo comments in file.js