See https://github.com/google/certificate-transparency/issues/1136
Simplifies the code and hopefully reduces memory usage