improved stack exchange patterns