Refactoring, use function array_walk_recursive