add copy flag, improve scan and build logic