Changing extensions.join to extensions.flatten.compact.join