add case checking queue empty

need to work on priority next