Tweaked analytics code