added code that updates the ready_queue