added triangle type and validity determinatation (no refactoring yet)