A method of stabilizing orientation values of an electronic device, the orientation values representing an orientation of the electronic device, the method comprising: obtaining first sensor readings from a first sensor, the first sensor readings for calculating the orientation values; obtaining second sensor readings from a second sensor, the second sensor readings for calculating the orientation values; calculating the orientation values using the first sensor readings and the second sensor readings; evaluating the first sensor readings and the second sensor readings to determine whether the orientation of the electronic device is stationary; locking the orientation values when the orientation of the electronic device is stationary; collecting at least one of further first sensor readings and further second sensor readings while the orientation values are locked; determining whether the orientation of the electronic device is changing by more than a threshold amount based on one or more of the further first sensor readings and the further second sensor readings; unlocking the orientation values for updating based on the further sensor readings when the orientation of the electronic device is changing by more than the threshold amount; characterized by correcting the orientation values using a reference point determined using at least one of the further second sensor readings and third sensor readings, the third sensor readings obtained from a third sensor while the orientation values are locked; wherein the first sensor is a gyroscope, the second sensor is an accelerometer and the third sensor is a magnetometer; determining that the further accelerometer readings and the magnetometer readings are within a benchmark value; wherein the benchmark value is based on a past orientation of the electronic device; calculating the reference point using the further accelerometer readings and the magnetometer readings; and while the orientation values are unlocked, correcting the orientation values using the calculated reference point. obtaining first sensor readings from a first sensor, the first sensor readings for calculating the orientation values; obtaining second sensor readings from a second sensor, the second sensor readings for calculating the orientation values; calculating the orientation values using the first sensor readings and the second sensor readings; evaluating the first sensor readings and the second sensor readings to determine whether the orientation of the electronic device is stationary; locking the orientation values when the orientation of the electronic device is stationary; collecting at least one of further first sensor readings and further second sensor readings while the orientation values are locked; determining whether the orientation of the electronic device is changing by more than a threshold amount based on one or more of the further first sensor readings and the further second sensor readings; unlocking the orientation values for updating based on the further sensor readings when the orientation of the electronic device is changing by more than the threshold amount; characterized by correcting the orientation values using a reference point determined using at least one of the further second sensor readings and third sensor readings, the third sensor readings obtained from a third sensor while the orientation values are locked; wherein the first sensor is a gyroscope, the second sensor is an accelerometer and the third sensor is a magnetometer; determining that the further accelerometer readings and the magnetometer readings are within a benchmark value; wherein the benchmark value is based on a past orientation of the electronic device; calculating the reference point using the further accelerometer readings and the magnetometer readings; and while the orientation values are unlocked, correcting the orientation values using the calculated reference point.