1st iteration of algo complete