updated analystic code