prepare to do first phase of algorithm