Updated with proper pause function