rewrote buffering code for better performance and simplicity, changed references to coloring to use labeling