Added findEndPoints and findS