chore(refactoring): cleans up and simplifies logic in filestore lib