Changed leave filtering logic