changed queue algo
final