refactoring code not completed: added progress bar and using random fill option in makepersistence