Added curve building to analytics and some extra calculations