generalize date filter
misc cleanup