backport of master, function-centric print