fixed error in writing Rdata to file. Deleted some old parts of the code for alternate pathnames