buffer: added peek routines and more helpers