Update tests, rewrite some logic, no reliance on Datum object