Added copying and uploading files

There are also various general improvements (removing redundancy, etc)