Added cost + fix bug where mats duplicate