added queue_len function