Adjusted weighting algorithm. And also fixes for timer task errors.