rewrite buffered queue to be faster