Added conditional to handle strings not ending in delimiter