changed way of getting application directory
added creation of filenames