Improved calculation function with optional type
Tupples