implemented offset calibration, some tweaks necessary but almost there!