clean implementation of finding segment start key