Updated Interlocking ALgorithm