used lowerBound function