Fixed scheduler

Function next_thread_to_run() now find the highest priority thread to
run. If there is no higher priority thread it either yields to the next
thread with the same priority or if there isn't any it runs again.