added loop count and max loop depth