analysis code cleanup