Main analysis routine
changed program structure to have subprograms for xml parsing