added general fn recursive copy