Refactor the copy interface, fix minor bugs