the calculations are now implemented as functions

cleaning the code for a better overview and gettered the calculations in functions.
I will add more commits about what i've done later