refactored updatemotion to confirm with JSLint