cleaning up the get_string() function