Memory optimization

Improve memory allocation to let the Garbage Collector be happy (and save a lot of cats).