additionally changed signature of called functions
to reflect the moved responsibility to allocate