separate out the addFilter function