Improved saving of data in folders

Images and matrices are now saved in more suitable subfolders