why all these calcSize is needed? Does it have some sideeffect? For me it looks like it can be called only once when everything is added.