working single iteration