Tidy up avoidance code