modified for inheritance