There was a lot of code duplication. I removed the initialization of xLabel{} and yLabels{} because those are scratch buffers that shouldn't be accessed before being written to anyway.