Write once instead of in a loop