More memory usage improvements, this time at a rather large CPU expense