changed smd->mtable ot smd->mbtree,added some other new func