Implementation of step 5