Added parent handling for contexts