refactored functions and included filestore file