working for loop with correct number of titles