Revised logic to handle large number of included accounts.