Analytics related files, some minor code clean up