Implementation of first iteration