Optimizing cloning script