final version, still need to manually specify file name for .txt and .xml s