Add ResetAR to reset AR elements, clean up code structure.