faster perforance with lower_bound, removed binary search