Rename variables, track distance, remove some functions.

By tracking the distance from the end of the buffer, we're able to
easily see whether or not we've run into a partial frame without any
repeated calculation.

Additionally, I felt that the intent of parseFrames would be clearer if
it was given a buffer as an argument, and then saved off a partial
buffer if a partial frame was found.

Calculation functions were removed because they weren't being reused.
They're now inlined in the main loop.