optimize code, add queue_is_empty method