Final analysis code