updated analysis code