copy struture code implementation