Implemented step 2 of algorithm from paper