Improved script for running all the tests for the protocol
Minor fixes on segments.py