extract calculation in a seperate class