Upgraded analytics code