Refactor clear buffer system (omegalib issue #128)