added "for" cycle instead of repeating code