Now also substructure analysis code working