1st version of segment constructor working