implemented buffer class