[refactor] Changed the internal logic, added sanitizer.