Sped up writing to file in trending once filtered