fixed the inheritance code so it now runs in the correct direction!