replace temporary struct with a pointer, saving us two memcpy's