Finished the segment functions.