add the part for recursive calculation