fix handling empty lists
adding iterators
these are mainly for convenience when writing loops
quick and dirty map-reduce implementation
fix memory leaks in tests