version3 before loop and p