Another performance optimization (in reading pixel values from buffer); simplifying and fixing current Main