Only allocate struct once we need it.