Added read-ahead buffer and tests. Closes #26.