Added main analysis routine