loop to clear workspace memory changed to use sizeof rather than hardcoded 4 to be compatible with CPUs with 64-bit ints