reworked to not rely on local files
both copy operations replaced with one big xcopy, and targeted rename
error handling improved
slight changes to many functions