Refactor the word management for files, added simple example