separated out the string printing function