AR compass filter and code clean-up