fine tuning code