Some tuning and optimization