Many changes

Functions signatures changed (X, Y := TVertex), check for verteces
intersect added, refactoring.