moved code outside for-loop