work on buf class, changed some file structure