move common code to superclasses