Cleaned up copy code