refactored filtering by Charactor or Whitespace