A method of operating an apparatus while advancing with rotation in a borehole , the method comprising: determining angular position of the apparatus about an axis of the apparatus relative to the borehole during the rotation in the borehole by using angular rate readings from an angular rate sensor of the apparatus ; correcting the determination of the angular position of the apparatus relative to a toolface offset (TFO) of the apparatus using at least one magnetometer and at least one accelerometer, at least one of which having an orthogonal pair, by: dividing each of the rotations into a plurality of divisions using the at least one orthogonal pair; determining a magnetic toolface (MTF) of the apparatus during the rotation based on geomagnetic readings from the at least one magnetometer of the apparatus in each of the divisions of the rotation relative to the geomagnetic field of reference, determining a gravitational toolface (GTF) of the apparatus during the rotation based on gravitational readings from the at least one accelerometer of the apparatus in each of the divisions of the rotation relative to the gravitational field of reference, and calculating the toolface offset (TFO) of the apparatus as a difference between the magnetic toolface (MTF) and the gravitational toolface (GTF); and directing the apparatus in the borehole based on the corrected angular position. determining angular position of the apparatus about an axis of the apparatus relative to the borehole during the rotation in the borehole by using angular rate readings from an angular rate sensor of the apparatus ; correcting the determination of the angular position of the apparatus relative to a toolface offset (TFO) of the apparatus using at least one magnetometer and at least one accelerometer, at least one of which having an orthogonal pair, by: dividing each of the rotations into a plurality of divisions using the at least one orthogonal pair; determining a magnetic toolface (MTF) of the apparatus during the rotation based on geomagnetic readings from the at least one magnetometer of the apparatus in each of the divisions of the rotation relative to the geomagnetic field of reference, determining a gravitational toolface (GTF) of the apparatus during the rotation based on gravitational readings from the at least one accelerometer of the apparatus in each of the divisions of the rotation relative to the gravitational field of reference, and calculating the toolface offset (TFO) of the apparatus as a difference between the magnetic toolface (MTF) and the gravitational toolface (GTF); and dividing each of the rotations into a plurality of divisions using the at least one orthogonal pair; determining a magnetic toolface (MTF) of the apparatus during the rotation based on geomagnetic readings from the at least one magnetometer of the apparatus in each of the divisions of the rotation relative to the geomagnetic field of reference, determining a gravitational toolface (GTF) of the apparatus during the rotation based on gravitational readings from the at least one accelerometer of the apparatus in each of the divisions of the rotation relative to the gravitational field of reference, and calculating the toolface offset (TFO) of the apparatus as a difference between the magnetic toolface (MTF) and the gravitational toolface (GTF); and directing the apparatus in the borehole based on the corrected angular position. <EOS>