Implement lower_bound and upper_bound