some changes. removed vertex2triangle for performance reasons.