moved cgraph file collection into middleware