New logic without using a loop