change list of files to function