almost done with first twophase method