Changed type of buffer for genericity to Runnable