The initialize method was calling beginResetModel twice without a corresponding endResetModel call. This could cause model state inconsistencies.
There's still some stuff that could potentially go elsewhere but I think it's enough for now.