enh: compressing more into functions