Cleaned up main_emg