adding code to perform conditional check of whole queue