Reorganized code. Moved code from AnalysisActivity to MotionAnalyzer