Sanitize 'filterComments' and improve readability/modularity