Refactor and simplify triangle reader