analytics added and some small bug fixes