Upgraded analytics code.