formatting analytics views code and taking out unnecessary code