added comments to the methods
changed the calculation model

I also added comments to understand better what is done