Added sensor fusion code to properly calculate device orientation.