works for multiple files. finally