this code is repeated in all implementations, should be in the base class?