cat.cpp updated for buffer speed