New version that handles multiple filepaths