Significantly cleaned up analyze_data.py