Removed on click from HTML and Handeled corner cases for substring