Added recursive calculation