added loop closure detection