implemented two-stage building