extracting common logic to superclass