changed 'for' statement