fine tuning code mode hooks