Major fixes to dispatcher algorithm