Modified output values in corresponding with spec and added mininmum spanning tree logic