read the method because we need it in getEndPosition