adding updated stat analtyc code