Replaced the implementation. Instead of using str.split, we now use re.findall and re.sub.