defind buildRig method..