added tuning function