Remove unnecessary substringing