performance tuning - calculating needs slightly fewer recursions