Rename ClearBuffer argument from actualStart to logicalIndex, and correct buffer clearing logic. Fixes #5.