first pass at segment extraction