Refactored code to require filestore class that reads and writes to a file