first robust version of FTP script, still working on it though