Use MIN_N rather than 0 (and other non-essential changes).