improve stack layout