Implemented url cleaning function