refactoring for adding presistence (swarms,embed,etc), wip