move list of files into function