I've left this code for perf. tuning