some code tuning