main analysis script