refactoring of output strings sanitization