Refactoring: added copyNamedTuple function