refactor of copyfile and add nose test