implement bstmap