Implemented bed skew calibration by matching a precise physical model to the measured data using the least squares method. Rewrote handling of the command buffer to preserve memory and allow pushing the commands to the front of the queue.