run in two phases