better recursive calculation for dones