added analytics; some bugfixes