Make work packages sum calculation function reusable