changed string building to use format()