Factor glob expansion into separate function