create avoid function