Further bug fixes and addition of analytics tracking