Added logic for heat control