Refactoring to ensure proper copy