plugins/hang: rewrite to simplify