Added improved calculation mechanism.