Refactor code by creating a filter to determine if conversion should be done.