implement templated logic