used vector for buffers, some RAII also