sty: refactor to promote code reuse