Do not call memset multiple times - minor speedup improvement