Add RemoteFile.renameTo and a bit of refactoring