Adapted the sample to modified branch handling