some refactoring to use toString whenever possible when converting to string