now it's recursion-friendly