mod2, readN, split, cleanup

Added mod2 function,
Added experimental function for readN (for review, not used yet), we could use this pattern also for modN etc. 
Added split function for DML and tests
Cleaned up reduce code, changed code to use K,V pairs