refactor memory initializer code to use run dependencies