refactored code to have correct new functions from filestore passed vars