updated inheritance code