```\nfunction remove(UniqueAddressQueue storage baseQueue, address addrToRemove) internal returns (bool) {\n    if (!contains(baseQueue, addrToRemove)) {\n        return false;\n    }\n\n    if (baseQueue.HEAD == addrToRemove) {\n        return removeFirst(baseQueue);\n    }\n\n    if (baseQueue.TAIL == addrToRemove) {\n        return removeLast(baseQueue);\n    }\n\n    address prevAddr = baseQueue.queue[addrToRemove].prev;\n    address nextAddr = baseQueue.queue[addrToRemove].next;\n    baseQueue.queue[prevAddr].next = nextAddr;\n    baseQueue.queue[nextAddr].prev = prevAddr;\n    baseQueue.queueLength--;\n\n    return true;\n}\n```\n