Refactored triangulator