updated to handle no files case