Analytics

Changed some things, different from previous PR.