Buffer usage

Minor refactoring @xla  @juliusv