copy main code