adding selfing to code