if else loop added to list element