changed method signature to allow subclasses as well