made the triangle code more readable