This isn't a perfect implementation yet: but it's enough to take a look at the memory usage and speed.