finish aqi function