buffer updates

credit to lurkwingduck