Implemented strings sanitizer

And refactored some code as well.