change to previous implementation for iteration