Refactor condition, added clearing of non UTF8 characters