Added wrapper for treap, fixed bugs