New analytics code
Source clean up and minor UI changes