pass const refs instead of copy
Move common code into base class