Queue Processing Code