Fix bug memory usage and dulicate datapoints.

By default it will now keep memory size small instead of accumulating until the OS gives a memory warning.

When getting data points from storage the result could contain duplicates (due to a datapoint being both in memory and storage). Fixed.