Version with memory leaks.