added segment-hadnling routines to arraymorph including many tests