improved printrecursive