Added buffer implementation and unittests.