pass1 and pass2 basically done