Simplify 'buffer' signature to be the same as 'window'.
Update doc comments.
Merge pull request #1035 from vigdorchik/scala_cleanup

Scala cleanup