Segworm code rewritten to use Matlab classes and packages