Minimized code for filtering functions