Another way to implement triangles without using seperate variables