Refactor type filtering functions

Found some syntax sugar, applied it here.