newest rendition of the loadfile function and some bug fixes in save function