Trying to find and fix a memory leak resulted in a FEW optimisations