Implemented unranked status and code optimization

Added static array of queues, which are always three, and checked if there is any unranked status in any queue.