Testing the buffering functions.
Using min() function where applicable.
TODO added.