added shared code and segment processor