added buildPlan method