Implementation of the second iteration