add option for a max buffer size