Small optimizations/code cleanup in Viewer, MotionController