main analysis clean up