Not meant to be readable, it is all just a substitute for doing the calculations on the raw arrays in HistoryBuffer. I added some more comments, should clear some things up. Think of HistoryBuffer as a data structure, it doesn't have much that is private, and it has a lot of helper functions to manipulate it's data.