separate cloning from compiling
add copy function template for copying from a source to a sink