Fixed the subtract module to correctly handle duplicate entries at the cost of speed.