Added more NDC tests. Optmized func a bit.