Queue algorithm implemented.