Helper classes and minor fixes
Better buffer handling