factored non-template code into base class to reduce template bloat