ch3 - pseudo code of the BAE implementation