-Placed the string reader into a function