MAny changes to make it compatible with dstore, still in progress