Puts same.type functionality in a loop