Optimize a bit with a better buffer-clearing function
Optimize filling, improve plotPoint slightly