first round implementation of segment2
more tests and readme