first pass v3 algorithm done