changed queue code