Tuning sorting timer code