Moved the string parser to its own function.