broke out analytics parsing into its own function ; general code cleanup ; removed comments ; reformatting