second attempt, shortened for loop.