binary search tree instead of linear search