added titles and changed loop