Apparatus and methods are described for use with a portion of plant material that includes at least one active ingredient. A vaporizing unit includes a heating element configured to heat the plant material, and a sensor configured to detect an indication of airflow rate through the vaporizing unit. Control circuitry is configured to receive an indication of the airflow rate through the vaporizing unit, and, in response thereto, to determine a smoking profile that is desired by the user. The control circuitry drives the heating element to vaporize the active ingredient of the plant material by heating the plant material according to the determined smoking profile. The control circuitry dynamically updates the smoking profile in response to changes in airflow rate over the course of a smoking session. Other applications are also described.