eliminating segmentation Fault and improving testing.