Reimplemented used stack size recalculation (replaced 3d4babdc2b03515fa30e382125a7e79d10bafe7e)